Skip to content

Commit

Permalink
Merge pull request openvinotoolkit#65 from almilosz/almilosz/names-re…
Browse files Browse the repository at this point in the history
…factor

Rename getPrecision() to getElementType()
  • Loading branch information
almilosz authored Nov 21, 2023
2 parents e15aa88 + e5637b2 commit 72c5ecf
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/bindings/js/node/include/tensor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TensorWrap : public Napi::ObjectWrap<TensorWrap> {
/** @return Napi::Array containing a tensor shape. */
Napi::Value get_shape(const Napi::CallbackInfo& info);
/** @return Napi::String containing ov::element type. */
Napi::Value get_precision(const Napi::CallbackInfo& info);
Napi::Value get_element_type(const Napi::CallbackInfo& info);

private:
ov::Tensor _tensor;
Expand Down
2 changes: 1 addition & 1 deletion src/bindings/js/node/lib/addon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ interface CompiledModel {

interface Tensor {
data: number[];
getPrecision(): element;
getElementType(): element;
getShape(): number[];
getData(): number[];
}
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/js/node/src/tensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Napi::Function TensorWrap::GetClassConstructor(Napi::Env env) {
{InstanceAccessor<&TensorWrap::get_data>("data"),
InstanceMethod("getData", &TensorWrap::get_data),
InstanceMethod("getShape", &TensorWrap::get_shape),
InstanceMethod("getPrecision", &TensorWrap::get_precision)});
InstanceMethod("getElementType", &TensorWrap::get_element_type)});
}

Napi::Object TensorWrap::Init(Napi::Env env, Napi::Object exports) {
Expand Down Expand Up @@ -138,6 +138,6 @@ Napi::Value TensorWrap::get_shape(const Napi::CallbackInfo& info) {
return cpp_to_js<ov::Shape, Napi::Array>(info, _tensor.get_shape());
}

Napi::Value TensorWrap::get_precision(const Napi::CallbackInfo& info) {
Napi::Value TensorWrap::get_element_type(const Napi::CallbackInfo& info) {
return cpp_to_js<ov::element::Type_t, Napi::String>(info, _tensor.get_element_type());
}
4 changes: 2 additions & 2 deletions src/bindings/js/node/tests/tensor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('Tensor without data parameters', () => {
describe('Tensor data', () => {

params.forEach(([type, stringType, data]) => {
it(`Set tensor data with ${stringType} precision`, () => {
it(`Set tensor data with ${stringType} element type`, () => {
const tensor = new ov.Tensor(type, shape, data);
assert.deepStrictEqual(tensor.data, data);
});
Expand Down Expand Up @@ -133,7 +133,7 @@ describe('Tensor element type', () => {
params.forEach(([elemType, , data]) => {
it(`Comparison of ov.element ${elemType} got from Tensor object`, () => {
const tensor = new ov.Tensor(elemType, shape, data);
assert.strictEqual(tensor.getPrecision(), elemType);
assert.strictEqual(tensor.getElementType(), elemType);
});
});
});

0 comments on commit 72c5ecf

Please sign in to comment.