blob: 8cbcf057c96014a1fcdaad9be711a313a963a976 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
// META: title=test WebNN API slice operation
// META: global=window,dedicatedworker
// META: script=./resources/utils.js
// META: timeout=long
'use strict';
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-slice
const buildSlice = (operationName, builder, resources) => {
// MLOperand slice(MLOperand input, sequence<long> starts, sequence<long> sizes, optional MLSliceOptions options = {});
const namedOutputOperand = {};
const inputOperand = createSingleInputOperand(builder, resources);
// invoke builder.slice()
namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.starts, resources.sizes, resources.options);
return namedOutputOperand;
};
testWebNNOperation('slice', '/webnn/resources/test_data/slice.json', buildSlice);
|