Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Retribution98 committed Jan 29, 2025
1 parent 94bf842 commit e553561
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/bindings/js/node/src/node_output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Napi::Value Output<ov::Node>::get_partial_shape(const Napi::CallbackInfo& info)
}

Napi::Value Output<ov::Node>::get_any_name(const Napi::CallbackInfo& info) {
return Napi::String::New(info.Env(), _output.get_node()->get_name());
return Napi::String::New(info.Env(), _output.get_any_name());
}

Output<const ov::Node>::Output(const Napi::CallbackInfo& info)
Expand Down Expand Up @@ -88,5 +88,5 @@ Napi::Value Output<const ov::Node>::get_partial_shape(const Napi::CallbackInfo&
}

Napi::Value Output<const ov::Node>::get_any_name(const Napi::CallbackInfo& info) {
return Napi::String::New(info.Env(), _output.get_node()->get_name());
return Napi::String::New(info.Env(), _output.get_any_name());
}
14 changes: 5 additions & 9 deletions src/bindings/js/node/tests/unit/infer_request.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ describe('ov.InferRequest tests with missing outputs names', () => {

const core = new ov.Core();

let modelData = await fs.readFile(getModelPath(modelV3Small).xml, 'utf8');
const weights = await fs.readFile(getModelPath(modelV3Small).bin);
let modelData = await fs.readFile(modelV3Small.xml, 'utf8');
const weights = await fs.readFile(modelV3Small.bin);
modelData = modelData.replace(
'names="MobilenetV3/Predictions/Softmax:0"',
''
Expand All @@ -350,24 +350,20 @@ describe('ov.InferRequest tests with missing outputs names', () => {
inferRequest = compiledModel.createInferRequest();

tensorData = Float32Array.from(
{ length: 150528 },
{ length: lengthFromShape(modelV3Small.inputShape) },
() => Math.random() + epsilon,
);
tensor = new ov.Tensor(ov.element.f32, modelV3Small.inputShape, tensorData);
});

it('Test infer(inputData: Tensor[])', () => {
const outputLayer = compiledModel.outputs[0];
const result = inferRequest.infer([tensor]);
assert.deepStrictEqual(Object.keys(result), [outputLayer.toString()]);
assert.ok(result[outputLayer] instanceof ov.Tensor);
assert.deepStrictEqual(Object.keys(result).length, 1);
});

it('Test inferAsync(inputData: Tensor[])', () => {
inferRequest.inferAsync([tensor]).then((result) => {
const outputLayer = compiledModel.outputs[0];
assert.deepStrictEqual(Object.keys(result), [outputLayer.toString()]);
assert.ok(result[outputLayer] instanceof ov.Tensor);
assert.deepStrictEqual(Object.keys(result).length, 1);
});
});
});
4 changes: 2 additions & 2 deletions src/bindings/js/node/tests/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const testModels = {
'https://media.githubusercontent.com/media/openvinotoolkit/testdata/master/models/test_model/test_model_fp32.bin',
},
modelV3Small: {
xml: 'v3-small_224_1.0_float.xml',
bin: 'v3-small_224_1.0_float.bin',
xml: getModelPath('v3-small_224_1.0_float.xml'),
bin: getModelPath('v3-small_224_1.0_float.bin'),
inputShape: [1, 224, 224, 3],
outputShape: [1, 1001],
xmlURL:
Expand Down

0 comments on commit e553561

Please sign in to comment.