onnxruntime/nodejs/test/e2e/inference-session-run.ts
Yulong Wang 842be1535d
[Node.js binding] add linux and mac package (#4157)
* try mac pipeline

* fix path separator

* copy prebuilds folder

* split esrp yaml for win/mac

* disable mac signing temporarily

* add linux

* fix indent

* add nodetool in linux

* add nodetool in win-ci-2019

* replace linux build by custom docker scripts

* use manylinux as node 12.16 not working on centos6

* try ubuntu

* loosen timeout for test case - multiple runs calls
2020-06-08 14:12:05 -07:00

26 lines
1 KiB
TypeScript

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import * as path from 'path';
import {Tensor} from '../../lib';
import {InferenceSession} from '../../lib/inference-session';
import {SQUEEZENET_INPUT0_DATA, SQUEEZENET_OUTPUT0_DATA, TEST_DATA_ROOT} from '../test-utils';
import {assertTensorEqual} from '../test-utils';
describe('E2E Tests - InferenceSession.run()', async () => {
let session: InferenceSession|null = null;
const input0 = new Tensor('float32', SQUEEZENET_INPUT0_DATA, [1, 3, 224, 224]);
const expectedOutput0 = new Tensor('float32', SQUEEZENET_OUTPUT0_DATA, [1, 1000, 1, 1]);
before(async () => {
session = await InferenceSession.create(path.join(TEST_DATA_ROOT, 'squeezenet.onnx'));
});
it('multiple run() calls', async () => {
for (let i = 0; i < 1000; i++) {
const result = await session!.run({'data_0': input0}, ['softmaxout_1']);
assertTensorEqual(result.softmaxout_1, expectedOutput0);
}
}).timeout('1200s');
});