// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. 'use strict'; it('Browser E2E testing - WebGPU backend with external data as Blob', async function () { // supplying external data as a Blob. In JSPI builds, the Blob is read on demand during session initialization // instead of being materialized in memory at once; in other builds it falls back to loading the whole content. const blob = await (await fetch('./model_with_orig_ext_data.bin')).blob(); const session = await ort.InferenceSession.create('./model_with_orig_ext_data.onnx', { executionProviders: ['webgpu'], externalData: [{ data: blob, path: 'model_with_orig_ext_data.bin' }], }); const fetches = await session.run({ X: new ort.Tensor('float32', [1, 1], [1, 2]) }); 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); });