Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// 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);
});