Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /webnn/conformance_tests/expand.https.any.html?cpu - WPT Dashboard Interop Dashboard
- /webnn/conformance_tests/expand.https.any.html?gpu - WPT Dashboard Interop Dashboard
- /webnn/conformance_tests/expand.https.any.html?npu - WPT Dashboard Interop Dashboard
- /webnn/conformance_tests/expand.https.any.worker.html?cpu - WPT Dashboard Interop Dashboard
- /webnn/conformance_tests/expand.https.any.worker.html?gpu - WPT Dashboard Interop Dashboard
- /webnn/conformance_tests/expand.https.any.worker.html?npu - WPT Dashboard Interop Dashboard
// META: title=test WebNN API expand operation
// META: global=window,dedicatedworker
// META: variant=?cpu
// META: variant=?gpu
// META: variant=?npu
// META: script=../resources/utils.js
// META: timeout=long
'use strict';
// Expand any dimension of size 1 of the input tensor to a larger size according
// to the new shape.
//
// MLOperand expand(
// MLOperand input, sequence<[EnforceRange] unsigned long> newShape);
const getExpandPrecisionTolerance = (graphResources) => {
const toleranceValueDict = {float32: 0, float16: 0};
const expectedDataType =
getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs);
return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]};
};
const expandTests = [
{
'name': 'expand float32 0D scalar to 1D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [24]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [24], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 0D scalar to 2D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [4, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 0D scalar to 3D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 4]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 0D scalar to 4D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 0D scalar to 5D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 2, 3, 1, 2], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D constant tensor to 1D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'},
'constant': true
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [24]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [24], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D tensor to 1D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [24]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [24], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D tensor to 2D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [4, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D tensor to 3D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 4]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D tensor to 4D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 1D tensor to 5D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 2, 3, 1, 2], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 2D (1st dimension)',
'graph': {
'inputs': {
'expandInput': {
'data': [
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375
],
'descriptor': {shape: [1, 6], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375
],
'descriptor': {shape: [4, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 2D (2nd dimension)',
'graph': {
'inputs': {
'expandInput': {
'data': [
4.965915679931641, 66.14382934570312, 75.28175354003906,
49.998130798339844
],
'descriptor': {shape: [4, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
4.965915679931641, 4.965915679931641, 4.965915679931641,
4.965915679931641, 4.965915679931641, 4.965915679931641,
66.14382934570312, 66.14382934570312, 66.14382934570312,
66.14382934570312, 66.14382934570312, 66.14382934570312,
75.28175354003906, 75.28175354003906, 75.28175354003906,
75.28175354003906, 75.28175354003906, 75.28175354003906,
49.998130798339844, 49.998130798339844, 49.998130798339844,
49.998130798339844, 49.998130798339844, 49.998130798339844
],
'descriptor': {shape: [4, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 2D (all dimensions)',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [4, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 3D',
'graph': {
'inputs': {
'expandInput': {
'data': [
4.965915679931641, 66.14382934570312, 75.28175354003906,
49.998130798339844
],
'descriptor': {shape: [4, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 4, 3]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
4.965915679931641, 4.965915679931641, 4.965915679931641,
66.14382934570312, 66.14382934570312, 66.14382934570312,
75.28175354003906, 75.28175354003906, 75.28175354003906,
49.998130798339844, 49.998130798339844, 49.998130798339844,
4.965915679931641, 4.965915679931641, 4.965915679931641,
66.14382934570312, 66.14382934570312, 66.14382934570312,
75.28175354003906, 75.28175354003906, 75.28175354003906,
49.998130798339844, 49.998130798339844, 49.998130798339844
],
'descriptor': {shape: [2, 4, 3], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 4D',
'graph': {
'inputs': {
'expandInput': {
'data': [
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375
],
'descriptor': {shape: [1, 6], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 2, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375,
10.898762702941895, -29.391416549682617, -73.74250793457031,
22.456905364990234, -97.5792465209961, -76.95013427734375
],
'descriptor': {shape: [2, 1, 2, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 2D tensor to 5D',
'graph': {
'inputs': {
'expandInput': {
'data': [-6.461850643157959],
'descriptor': {shape: [1, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 3, 2, 2]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959,
-6.461850643157959, -6.461850643157959, -6.461850643157959
],
'descriptor': {shape: [2, 1, 3, 2, 2], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 3D tensor to 3D',
'graph': {
'inputs': {
'expandInput': {
'data': [21.694129943847656, -72.82571411132812],
'descriptor': {shape: [1, 2, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 6]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
21.694129943847656, 21.694129943847656, 21.694129943847656,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
-72.82571411132812, -72.82571411132812, -72.82571411132812
],
'descriptor': {shape: [2, 2, 6], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 3D tensor to 4D',
'graph': {
'inputs': {
'expandInput': {
'data': [21.694129943847656, -72.82571411132812],
'descriptor': {shape: [1, 2, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812
],
'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 3D tensor to 5D',
'graph': {
'inputs': {
'expandInput': {
'data': [21.694129943847656, -72.82571411132812],
'descriptor': {shape: [1, 2, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 2, 2, 3]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812,
21.694129943847656, 21.694129943847656, 21.694129943847656,
-72.82571411132812, -72.82571411132812, -72.82571411132812
],
'descriptor': {shape: [2, 1, 2, 2, 3], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 4D tensor to 4D',
'graph': {
'inputs': {
'expandInput': {
'data': [12.799123764038086, -26.550199508666992],
'descriptor': {shape: [2, 1, 1, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 2, 2]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
12.799123764038086, 12.799123764038086, 12.799123764038086,
12.799123764038086, 12.799123764038086, 12.799123764038086,
12.799123764038086, 12.799123764038086, 12.799123764038086,
12.799123764038086, 12.799123764038086, 12.799123764038086,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
-26.550199508666992, -26.550199508666992, -26.550199508666992
],
'descriptor': {shape: [2, 3, 2, 2], dataType: 'float32'}
}
}
}
},
{
'name': 'expand float32 4D tensor to 5D',
'graph': {
'inputs': {
'expandInput': {
'data': [12.799123764038086, -26.550199508666992],
'descriptor': {shape: [2, 1, 1, 1], dataType: 'float32'}
}
},
'operators': [{
'name': 'expand',
'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}],
'outputs': 'expandOutput'
}],
'expectedOutputs': {
'expandOutput': {
'data': [
12.799123764038086, 12.799123764038086, 12.799123764038086,
12.799123764038086, 12.799123764038086, 12.799123764038086,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
12.799123764038086, 12.799123764038086, 12.799123764038086,
12.799123764038086, 12.799123764038086, 12.799123764038086,
-26.550199508666992, -26.550199508666992, -26.550199508666992,
-26.550199508666992, -26.550199508666992, -26.550199508666992
],
'descriptor': {shape: [2, 2, 3, 1, 2], dataType: 'float32'}
}
}
}
}
];
if (navigator.ml) {
expandTests.forEach((test) => {
webnn_conformance_test(
buildAndExecuteGraph, getExpandPrecisionTolerance, test);
});
} else {
test(() => assert_implements(navigator.ml, 'missing navigator.ml'));
}