2024-01-13 03:24:24 +00:00
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
|
// Licensed under the MIT License.
|
|
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
2024-08-14 23:51:22 +00:00
|
|
|
it('Browser E2E testing - WebGPU backend with external data', async function () {
|
2024-01-13 03:24:24 +00:00
|
|
|
const session = await ort.InferenceSession.create('./model_with_orig_ext_data.onnx', {
|
|
|
|
|
executionProviders: ['webgpu'],
|
2024-08-14 23:51:22 +00:00
|
|
|
externalData: [{ data: './model_with_orig_ext_data.bin', path: 'model_with_orig_ext_data.bin' }],
|
2024-01-13 03:24:24 +00:00
|
|
|
});
|
|
|
|
|
|
2024-08-14 23:51:22 +00:00
|
|
|
const fetches = await session.run({ X: new ort.Tensor('float32', [1, 1], [1, 2]) });
|
2024-01-13 03:24:24 +00:00
|
|
|
|
|
|
|
|
const Y = fetches.Y;
|
|
|
|
|
|
|
|
|
|
assert(Y instanceof ort.Tensor);
|
|
|
|
|
assert(Y.dims.length === 2 && Y.dims[0] === 2 && Y.dims[1] === 3);
|
|
|
|
|
assert(Y.data[0] === 1);
|
|
|
|
|
assert(Y.data[1] === 1);
|
|
|
|
|
assert(Y.data[2] === 0);
|
|
|
|
|
assert(Y.data[3] === 0);
|
|
|
|
|
assert(Y.data[4] === 0);
|
|
|
|
|
assert(Y.data[5] === 0);
|
|
|
|
|
});
|