diff options
Diffstat (limited to 'testing/web-platform/tests/webnn')
83 files changed, 39508 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webnn/META.yml b/testing/web-platform/tests/webnn/META.yml new file mode 100644 index 0000000000..3f87fc8042 --- /dev/null +++ b/testing/web-platform/tests/webnn/META.yml @@ -0,0 +1,4 @@ +spec: https://webmachinelearning.github.io/webnn/ +suggested_reviewers: + - dontcallmedom + - Honry
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/batch_normalization.https.any.js b/testing/web-platform/tests/webnn/batch_normalization.https.any.js new file mode 100644 index 0000000000..6644a92172 --- /dev/null +++ b/testing/web-platform/tests/webnn/batch_normalization.https.any.js @@ -0,0 +1,31 @@ +// META: title=test WebNN API batchNormalization operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-batchnorm + +const buildBatchNorm = (operationName, builder, resources) => { + // MLOperand batchNormalization(MLOperand input, MLOperand mean, MLOperand variance, + // optional MLBatchNormalizationOptions options = {}); + const namedOutputOperand = {}; + const [inputOperand, meanOperand, varianceOperand] = createMultiInputOperands(builder, resources); + const batchNormOptions = {...resources.options}; + if (batchNormOptions.scale) { + batchNormOptions.scale = createConstantOperand(builder, batchNormOptions.scale); + } + if (batchNormOptions.bias) { + batchNormOptions.bias = createConstantOperand(builder, batchNormOptions.bias); + } + if (batchNormOptions.activation) { + batchNormOptions.activation = builder[batchNormOptions.activation](); + } + // invoke builder.batchNormalization() + namedOutputOperand[resources.expected.name] = + builder[operationName](inputOperand, meanOperand, varianceOperand, batchNormOptions); + return namedOutputOperand; +}; + +testWebNNOperation('batchNormalization', buildBatchNorm);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/clamp.https.any.js b/testing/web-platform/tests/webnn/clamp.https.any.js new file mode 100644 index 0000000000..9818aed7c1 --- /dev/null +++ b/testing/web-platform/tests/webnn/clamp.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API clamp operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp + +testWebNNOperation('clamp', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/concat.https.any.js b/testing/web-platform/tests/webnn/concat.https.any.js new file mode 100644 index 0000000000..b91e99e289 --- /dev/null +++ b/testing/web-platform/tests/webnn/concat.https.any.js @@ -0,0 +1,22 @@ +// META: title=test WebNN API concat operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat + +const buildConcat = (operationName, builder, resources) => { + // MLOperand concat(sequence<MLOperand> inputs, unsigned long axis); + const namedOutputOperand = {}; + const inputOperands = []; + for (let input of resources.inputs) { + inputOperands.push(builder.input(input.name, {type: input.type, dimensions: input.shape})); + } + // invoke builder.concat() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperands, resources.axis); + return namedOutputOperand; +}; + +testWebNNOperation('concat', buildConcat);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/conv2d.https.any.js b/testing/web-platform/tests/webnn/conv2d.https.any.js new file mode 100644 index 0000000000..52e267a6d3 --- /dev/null +++ b/testing/web-platform/tests/webnn/conv2d.https.any.js @@ -0,0 +1,25 @@ +// META: title=test WebNN API conv2d operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-conv2d + +const buildConv2d= (operationName, builder, resources) => { + // MLOperand conv2d(MLOperand input, MLOperand filter, optional MLConv2dOptions options = {}); + const namedOutputOperand = {}; + const [inputOperand, filterOperand] = createMultiInputOperands(builder, resources); + let conv2dOptions = {...resources.options}; + if (conv2dOptions.bias) { + conv2dOptions.bias = createConstantOperand(builder, conv2dOptions.bias); + } + if (conv2dOptions.activation) { + conv2dOptions.activation = builder[conv2dOptions.activation](); + } + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, filterOperand, conv2dOptions); + return namedOutputOperand; +}; + +testWebNNOperation('conv2d', buildConv2d);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/conv_transpose2d.https.any.js b/testing/web-platform/tests/webnn/conv_transpose2d.https.any.js new file mode 100644 index 0000000000..8a1f30d527 --- /dev/null +++ b/testing/web-platform/tests/webnn/conv_transpose2d.https.any.js @@ -0,0 +1,25 @@ +// META: title=test WebNN API convTranspose2d operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-convtranspose2d + +const buildConvTranspose2d = (operationName, builder, resources) => { + // MLOperand convTranspose2d(MLOperand input, MLOperand filter, optional MLConvTranspose2dOptions options = {}); + const namedOutputOperand = {}; + const [inputOperand, filterOperand] = createMultiInputOperands(builder, resources); + let convTranspose2dOptions = {...resources.options}; + if (convTranspose2dOptions.bias) { + convTranspose2dOptions.bias = createConstantOperand(builder, convTranspose2dOptions.bias); + } + if (convTranspose2dOptions.activation) { + convTranspose2dOptions.activation = builder[convTranspose2dOptions.activation](); + } + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, filterOperand, convTranspose2dOptions); + return namedOutputOperand; +}; + +testWebNNOperation('convTranspose2d', buildConvTranspose2d);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/elementwise_binary.https.any.js b/testing/web-platform/tests/webnn/elementwise_binary.https.any.js new file mode 100644 index 0000000000..06c2404f95 --- /dev/null +++ b/testing/web-platform/tests/webnn/elementwise_binary.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API element-wise binary operations +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary + +testWebNNOperation(['add', 'sub', 'mul', 'div', 'max', 'min', 'pow'], buildOperationWithTwoInputs);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/elementwise_unary.https.any.js b/testing/web-platform/tests/webnn/elementwise_unary.https.any.js new file mode 100644 index 0000000000..3a6ccc8daf --- /dev/null +++ b/testing/web-platform/tests/webnn/elementwise_unary.https.any.js @@ -0,0 +1,13 @@ +// META: title=test WebNN API element-wise unary operations +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-unary + +testWebNNOperation( + ['abs', 'ceil', 'cos', 'exp', 'floor', 'log', 'neg', 'sin', 'tan'], + buildOperationWithSingleInput +);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/elu.https.any.js b/testing/web-platform/tests/webnn/elu.https.any.js new file mode 100644 index 0000000000..57b624b5da --- /dev/null +++ b/testing/web-platform/tests/webnn/elu.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API elu operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-elu + +testWebNNOperation('elu', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gemm.https.any.js b/testing/web-platform/tests/webnn/gemm.https.any.js new file mode 100644 index 0000000000..179a1649b6 --- /dev/null +++ b/testing/web-platform/tests/webnn/gemm.https.any.js @@ -0,0 +1,28 @@ +// META: title=test WebNN API gemm operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gemm + +const buildGemm= (operationName, builder, resources) => { + // MLOperand gemm(MLOperand a, MLOperand b, optional MLGemmOptions options = {}); + const namedOutputOperand = {}; + const [inputOperandA, inputOperandB] = createMultiInputOperands(builder, resources); + let gemmOptions = {...resources.options}; + if (gemmOptions.c) { + if (gemmOptions.c.shape) { + gemmOptions.c = createConstantOperand(builder, gemmOptions.c); + } else { + // MLOperand c; + // Create a single-value operand when c is a scalar + gemmOptions.c = builder.constant(gemmOptions.c); + } + } + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperandA, inputOperandB, gemmOptions); + return namedOutputOperand; +}; + +testWebNNOperation('gemm', buildGemm);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/hard_sigmoid.https.any.js b/testing/web-platform/tests/webnn/hard_sigmoid.https.any.js new file mode 100644 index 0000000000..81bd5124ce --- /dev/null +++ b/testing/web-platform/tests/webnn/hard_sigmoid.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API hardSigmoid operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-sigmoid + +testWebNNOperation('hardSigmoid', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/hard_swish.https.any.js b/testing/web-platform/tests/webnn/hard_swish.https.any.js new file mode 100644 index 0000000000..052c7f2a20 --- /dev/null +++ b/testing/web-platform/tests/webnn/hard_swish.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API tanh operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-swish + +testWebNNOperation('hardSwish', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/idlharness.https.any.js b/testing/web-platform/tests/webnn/idlharness.https.any.js new file mode 100644 index 0000000000..016422f3a3 --- /dev/null +++ b/testing/web-platform/tests/webnn/idlharness.https.any.js @@ -0,0 +1,56 @@ +// META: global=window,dedicatedworker +// META: script=/resources/WebIDLParser.js +// META: script=/resources/idlharness.js +// META: script=./resources/utils.js +// META: timeout=long + +// https://webmachinelearning.github.io/webnn/ + +'use strict'; + +idl_test( + ['webnn'], + ['html', 'webidl', 'webgpu'], + async (idl_array) => { + if (self.GLOBAL.isWindow()) { + idl_array.add_objects({ Navigator: ['navigator'] }); + } else if (self.GLOBAL.isWorker()) { + idl_array.add_objects({ WorkerNavigator: ['navigator'] }); + } + + idl_array.add_objects({ + NavigatorML: ['navigator'], + ML: ['navigator.ml'], + MLContext: ['context'], + MLOperand: ['input', 'filter', 'output'], + MLActivation: ['relu'], + MLGraphBuilder: ['builder'], + MLGraph: ['graph'] + }); + + for (const executionType of ExecutionArray) { + const isSync = executionType === 'sync'; + if (self.GLOBAL.isWindow() && isSync) { + continue; + } + + if (isSync) { + self.context = navigator.ml.createContextSync(); + } else { + self.context = await navigator.ml.createContext(); + } + + self.builder = new MLGraphBuilder(self.context); + self.input = builder.input('input', {type: 'float32', dimensions: [1, 1, 5, 5]}); + self.filter = builder.constant({type: 'float32', dimensions: [1, 1, 3, 3]}, new Float32Array(9).fill(1)); + self.relu = builder.relu(); + self.output = builder.conv2d(input, filter, {activation: relu, inputLayout: "nchw"}); + + if (isSync) { + self.graph = builder.buildSync({output}); + } else { + self.graph = await builder.build({output}); + } + } + } +); diff --git a/testing/web-platform/tests/webnn/leaky_relu.https.any.js b/testing/web-platform/tests/webnn/leaky_relu.https.any.js new file mode 100644 index 0000000000..61539ce92e --- /dev/null +++ b/testing/web-platform/tests/webnn/leaky_relu.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API leakyRelu operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-leakyrelu + +testWebNNOperation('leakyRelu', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/linear.https.any.js b/testing/web-platform/tests/webnn/linear.https.any.js new file mode 100644 index 0000000000..4b2c05540b --- /dev/null +++ b/testing/web-platform/tests/webnn/linear.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API linear operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-linear + +testWebNNOperation('linear', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/matmul.https.any.js b/testing/web-platform/tests/webnn/matmul.https.any.js new file mode 100644 index 0000000000..8a9882afe6 --- /dev/null +++ b/testing/web-platform/tests/webnn/matmul.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API matmul operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-matmul + +testWebNNOperation('matmul', buildOperationWithTwoInputs);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/pad.https.any.js b/testing/web-platform/tests/webnn/pad.https.any.js new file mode 100644 index 0000000000..f9d13d495f --- /dev/null +++ b/testing/web-platform/tests/webnn/pad.https.any.js @@ -0,0 +1,19 @@ +// META: title=test WebNN API pad operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-pad + +const buildPad = (operationName, builder, resources) => { + // MLOperand pad(MLOperand input, sequence<unsigned long> beginningPadding, sequence<unsigned long> endingPadding, optional MLPadOptions options = {}); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.pad() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.beginningPadding, resources.endingPadding, resources.options); + return namedOutputOperand; +}; + +testWebNNOperation('pad', buildPad);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/pooling.https.any.js b/testing/web-platform/tests/webnn/pooling.https.any.js new file mode 100644 index 0000000000..df19e57709 --- /dev/null +++ b/testing/web-platform/tests/webnn/pooling.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API pooling operations +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-pool2d + +testWebNNOperation(['averagePool2d', 'maxPool2d'], buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/prelu.https.any.js b/testing/web-platform/tests/webnn/prelu.https.any.js new file mode 100644 index 0000000000..c1b2e9fa2a --- /dev/null +++ b/testing/web-platform/tests/webnn/prelu.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API prelu operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-prelu + +testWebNNOperation('prelu', buildOperationWithTwoInputs);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/reduction.https.any.js b/testing/web-platform/tests/webnn/reduction.https.any.js new file mode 100644 index 0000000000..20bd74d8de --- /dev/null +++ b/testing/web-platform/tests/webnn/reduction.https.any.js @@ -0,0 +1,24 @@ +// META: title=test WebNN API reduction operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-reduce + +testWebNNOperation( + [ + 'reduceL1', + 'reduceL2', + 'reduceLogSum', + 'reduceLogSumExp', + 'reduceMax', + 'reduceMean', + 'reduceMin', + 'reduceProduct', + 'reduceSum', + 'reduceSumSquare', + ], + buildOperationWithSingleInput +);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/relu.https.any.js b/testing/web-platform/tests/webnn/relu.https.any.js new file mode 100644 index 0000000000..42b64e11de --- /dev/null +++ b/testing/web-platform/tests/webnn/relu.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API relu operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-relu + +testWebNNOperation('relu', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/reshape.https.any.js b/testing/web-platform/tests/webnn/reshape.https.any.js new file mode 100644 index 0000000000..a7126e63a1 --- /dev/null +++ b/testing/web-platform/tests/webnn/reshape.https.any.js @@ -0,0 +1,20 @@ +// META: title=test WebNN API reshape operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-reshape + +const buildReshape = (operationName, builder, resources) => { + // MLOperand reshape(MLOperand input, sequence<unsigned long?> newShape); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.reshape() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.newShape); + return namedOutputOperand; +}; + +testWebNNOperation('reshape', buildReshape); + diff --git a/testing/web-platform/tests/webnn/resources/test_data/abs.json b/testing/web-platform/tests/webnn/resources/test_data/abs.json new file mode 100644 index 0000000000..c59054c3e5 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/abs.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "abs float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 49.8372426667043, + 82.0929095991747, + 3.1989055476550305, + 85.20904780506325, + 88.94609443980977, + -91.0352208007506, + 31.448491185882546, + -29.311109216503752, + -92.44773429213686, + -15.520709757433963, + 80.91279287806162, + -38.209706112466705, + 53.064761629102065, + 99.6537077669756, + -21.28504881273652, + 90.019831849408, + 18.324518254754622, + -33.06915295290382, + 30.097660827399608, + -74.21503493794903, + 95.60974816793694, + 6.61428748549389, + 31.283208179548808, + -53.20605974670913 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 49.837242126464844, + 82.09291076660156, + 3.1989054679870605, + 85.20904541015625, + 88.94609069824219, + 91.03521728515625, + 31.4484920501709, + 29.31110954284668, + 92.4477310180664, + 15.520709991455078, + 80.91279602050781, + 38.2097053527832, + 53.064762115478516, + 99.6537094116211, + 21.285049438476562, + 90.01982879638672, + 18.32451820373535, + 33.06915283203125, + 30.097660064697266, + 74.21503448486328, + 95.60974884033203, + 6.614287376403809, + 31.2832088470459, + 53.206058502197266 + ], + "type": "float32" + } + }, + { + "name": "abs float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 49.8372426667043, + 82.0929095991747, + 3.1989055476550305, + 85.20904780506325, + 88.94609443980977, + -91.0352208007506, + 31.448491185882546, + -29.311109216503752, + -92.44773429213686, + -15.520709757433963, + 80.91279287806162, + -38.209706112466705, + 53.064761629102065, + 99.6537077669756, + -21.28504881273652, + 90.019831849408, + 18.324518254754622, + -33.06915295290382, + 30.097660827399608, + -74.21503493794903, + 95.60974816793694, + 6.61428748549389, + 31.283208179548808, + -53.20605974670913 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 49.837242126464844, + 82.09291076660156, + 3.1989054679870605, + 85.20904541015625, + 88.94609069824219, + 91.03521728515625, + 31.4484920501709, + 29.31110954284668, + 92.4477310180664, + 15.520709991455078, + 80.91279602050781, + 38.2097053527832, + 53.064762115478516, + 99.6537094116211, + 21.285049438476562, + 90.01982879638672, + 18.32451820373535, + 33.06915283203125, + 30.097660064697266, + 74.21503448486328, + 95.60974884033203, + 6.614287376403809, + 31.2832088470459, + 53.206058502197266 + ], + "type": "float32" + } + }, + { + "name": "abs float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 49.8372426667043, + 82.0929095991747, + 3.1989055476550305, + 85.20904780506325, + 88.94609443980977, + -91.0352208007506, + 31.448491185882546, + -29.311109216503752, + -92.44773429213686, + -15.520709757433963, + 80.91279287806162, + -38.209706112466705, + 53.064761629102065, + 99.6537077669756, + -21.28504881273652, + 90.019831849408, + 18.324518254754622, + -33.06915295290382, + 30.097660827399608, + -74.21503493794903, + 95.60974816793694, + 6.61428748549389, + 31.283208179548808, + -53.20605974670913 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 49.837242126464844, + 82.09291076660156, + 3.1989054679870605, + 85.20904541015625, + 88.94609069824219, + 91.03521728515625, + 31.4484920501709, + 29.31110954284668, + 92.4477310180664, + 15.520709991455078, + 80.91279602050781, + 38.2097053527832, + 53.064762115478516, + 99.6537094116211, + 21.285049438476562, + 90.01982879638672, + 18.32451820373535, + 33.06915283203125, + 30.097660064697266, + 74.21503448486328, + 95.60974884033203, + 6.614287376403809, + 31.2832088470459, + 53.206058502197266 + ], + "type": "float32" + } + }, + { + "name": "abs float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 49.8372426667043, + 82.0929095991747, + 3.1989055476550305, + 85.20904780506325, + 88.94609443980977, + -91.0352208007506, + 31.448491185882546, + -29.311109216503752, + -92.44773429213686, + -15.520709757433963, + 80.91279287806162, + -38.209706112466705, + 53.064761629102065, + 99.6537077669756, + -21.28504881273652, + 90.019831849408, + 18.324518254754622, + -33.06915295290382, + 30.097660827399608, + -74.21503493794903, + 95.60974816793694, + 6.61428748549389, + 31.283208179548808, + -53.20605974670913 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 49.837242126464844, + 82.09291076660156, + 3.1989054679870605, + 85.20904541015625, + 88.94609069824219, + 91.03521728515625, + 31.4484920501709, + 29.31110954284668, + 92.4477310180664, + 15.520709991455078, + 80.91279602050781, + 38.2097053527832, + 53.064762115478516, + 99.6537094116211, + 21.285049438476562, + 90.01982879638672, + 18.32451820373535, + 33.06915283203125, + 30.097660064697266, + 74.21503448486328, + 95.60974884033203, + 6.614287376403809, + 31.2832088470459, + 53.206058502197266 + ], + "type": "float32" + } + }, + { + "name": "abs float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 49.8372426667043, + 82.0929095991747, + 3.1989055476550305, + 85.20904780506325, + 88.94609443980977, + -91.0352208007506, + 31.448491185882546, + -29.311109216503752, + -92.44773429213686, + -15.520709757433963, + 80.91279287806162, + -38.209706112466705, + 53.064761629102065, + 99.6537077669756, + -21.28504881273652, + 90.019831849408, + 18.324518254754622, + -33.06915295290382, + 30.097660827399608, + -74.21503493794903, + 95.60974816793694, + 6.61428748549389, + 31.283208179548808, + -53.20605974670913 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 49.837242126464844, + 82.09291076660156, + 3.1989054679870605, + 85.20904541015625, + 88.94609069824219, + 91.03521728515625, + 31.4484920501709, + 29.31110954284668, + 92.4477310180664, + 15.520709991455078, + 80.91279602050781, + 38.2097053527832, + 53.064762115478516, + 99.6537094116211, + 21.285049438476562, + 90.01982879638672, + 18.32451820373535, + 33.06915283203125, + 30.097660064697266, + 74.21503448486328, + 95.60974884033203, + 6.614287376403809, + 31.2832088470459, + 53.206058502197266 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/add.json b/testing/web-platform/tests/webnn/resources/test_data/add.json new file mode 100644 index 0000000000..0a12871ceb --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/add.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "add float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -59.74972612329861, + -44.814940102501396, + -87.93879800134108, + 1.884336371742009, + 84.89464239219592, + 47.55365421202336, + 85.64292769131902, + 43.02861451385175, + -60.25821191056049, + 15.606167000302435, + 70.60614780317951, + -7.454866177806224, + -30.206895875534997, + -97.69825508598404, + -0.009843301412843175, + -77.6796011606304, + 30.19668513874859, + -59.19006932092632, + 89.35886332586315, + 28.679809244991418, + -29.72130634585804, + -90.63522901925083, + 28.281854673339666, + 27.66254066077893 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -103.08303833007812, + -112.71289825439453, + -61.47605895996094, + 38.627098083496094, + 19.717254638671875, + -40.15299606323242, + 150.9217529296875, + -31.02364730834961, + -74.08602142333984, + 22.58765411376953, + 170.44366455078125, + 48.34747314453125, + -105.77885437011719, + -86.19874572753906, + 17.100265502929688, + 18.13207244873047, + 87.64418029785156, + -116.3659439086914, + 117.07791900634766, + 10.460599899291992, + 22.931793212890625, + -160.62979125976562, + 68.10350799560547, + -2.3239879608154297 + ], + "type": "float32" + } + }, + { + "name": "add float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -59.74972612329861, + -44.814940102501396, + -87.93879800134108, + 1.884336371742009, + 84.89464239219592, + 47.55365421202336, + 85.64292769131902, + 43.02861451385175, + -60.25821191056049, + 15.606167000302435, + 70.60614780317951, + -7.454866177806224, + -30.206895875534997, + -97.69825508598404, + -0.009843301412843175, + -77.6796011606304, + 30.19668513874859, + -59.19006932092632, + 89.35886332586315, + 28.679809244991418, + -29.72130634585804, + -90.63522901925083, + 28.281854673339666, + 27.66254066077893 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -103.08303833007812, + -112.71289825439453, + -61.47605895996094, + 38.627098083496094, + 19.717254638671875, + -40.15299606323242, + 150.9217529296875, + -31.02364730834961, + -74.08602142333984, + 22.58765411376953, + 170.44366455078125, + 48.34747314453125, + -105.77885437011719, + -86.19874572753906, + 17.100265502929688, + 18.13207244873047, + 87.64418029785156, + -116.3659439086914, + 117.07791900634766, + 10.460599899291992, + 22.931793212890625, + -160.62979125976562, + 68.10350799560547, + -2.3239879608154297 + ], + "type": "float32" + } + }, + { + "name": "add float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data":[ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -59.74972612329861, + -44.814940102501396, + -87.93879800134108, + 1.884336371742009, + 84.89464239219592, + 47.55365421202336, + 85.64292769131902, + 43.02861451385175, + -60.25821191056049, + 15.606167000302435, + 70.60614780317951, + -7.454866177806224, + -30.206895875534997, + -97.69825508598404, + -0.009843301412843175, + -77.6796011606304, + 30.19668513874859, + -59.19006932092632, + 89.35886332586315, + 28.679809244991418, + -29.72130634585804, + -90.63522901925083, + 28.281854673339666, + 27.66254066077893 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -103.08303833007812, + -112.71289825439453, + -61.47605895996094, + 38.627098083496094, + 19.717254638671875, + -40.15299606323242, + 150.9217529296875, + -31.02364730834961, + -74.08602142333984, + 22.58765411376953, + 170.44366455078125, + 48.34747314453125, + -105.77885437011719, + -86.19874572753906, + 17.100265502929688, + 18.13207244873047, + 87.64418029785156, + -116.3659439086914, + 117.07791900634766, + 10.460599899291992, + 22.931793212890625, + -160.62979125976562, + 68.10350799560547, + -2.3239879608154297 + ], + "type": "float32" + } + }, + { + "name": "add float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -59.74972612329861, + -44.814940102501396, + -87.93879800134108, + 1.884336371742009, + 84.89464239219592, + 47.55365421202336, + 85.64292769131902, + 43.02861451385175, + -60.25821191056049, + 15.606167000302435, + 70.60614780317951, + -7.454866177806224, + -30.206895875534997, + -97.69825508598404, + -0.009843301412843175, + -77.6796011606304, + 30.19668513874859, + -59.19006932092632, + 89.35886332586315, + 28.679809244991418, + -29.72130634585804, + -90.63522901925083, + 28.281854673339666, + 27.66254066077893 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -103.08303833007812, + -112.71289825439453, + -61.47605895996094, + 38.627098083496094, + 19.717254638671875, + -40.15299606323242, + 150.9217529296875, + -31.02364730834961, + -74.08602142333984, + 22.58765411376953, + 170.44366455078125, + 48.34747314453125, + -105.77885437011719, + -86.19874572753906, + 17.100265502929688, + 18.13207244873047, + 87.64418029785156, + -116.3659439086914, + 117.07791900634766, + 10.460599899291992, + 22.931793212890625, + -160.62979125976562, + 68.10350799560547, + -2.3239879608154297 + ], + "type": "float32" + } + }, + { + "name": "add float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -59.74972612329861, + -44.814940102501396, + -87.93879800134108, + 1.884336371742009, + 84.89464239219592, + 47.55365421202336, + 85.64292769131902, + 43.02861451385175, + -60.25821191056049, + 15.606167000302435, + 70.60614780317951, + -7.454866177806224, + -30.206895875534997, + -97.69825508598404, + -0.009843301412843175, + -77.6796011606304, + 30.19668513874859, + -59.19006932092632, + 89.35886332586315, + 28.679809244991418, + -29.72130634585804, + -90.63522901925083, + 28.281854673339666, + 27.66254066077893 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2, 3], + "data": [ + -103.08303833007812, + -112.71289825439453, + -61.47605895996094, + 38.627098083496094, + 19.717254638671875, + -40.15299606323242, + 150.9217529296875, + -31.02364730834961, + -74.08602142333984, + 22.58765411376953, + 170.44366455078125, + 48.34747314453125, + -105.77885437011719, + -86.19874572753906, + 17.100265502929688, + 18.13207244873047, + 87.64418029785156, + -116.3659439086914, + 117.07791900634766, + 10.460599899291992, + 22.931793212890625, + -160.62979125976562, + 68.10350799560547, + -2.3239879608154297 + ], + "type": "float32" + } + }, + { + "name": "add float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + -59.36157224952288 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -102.69488525390625, + -127.25952911376953, + -32.898834228515625, + -22.61880874633789, + -124.5389633178711, + -147.06822204589844, + 5.917243957519531, + -133.41383361816406, + -73.18938446044922, + -52.38008499145508, + 40.47594451904297, + -3.559234619140625, + -134.93353271484375, + -47.862064361572266, + -42.25146484375, + 36.450103759765625, + -1.9140739440917969, + -116.53744506835938, + -31.642518997192383, + -77.58078002929688, + -6.708473205566406, + -129.3561248779297, + -19.5399169921875, + -89.34809875488281 + ], + "type": "float32" + } + }, + { + "name": "add float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -17.98112396221225, + -70.45854393523281, + -12.762018804699252, + 24.254031986371018, + -68.125990738312, + 30.626274734168845 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -61.3144416809082, + -138.35650634765625, + 13.70072078704834, + 60.996795654296875, + -133.30337524414062, + -57.08037567138672, + 47.297691345214844, + -144.51080322265625, + -26.589828491210938, + 31.235519409179688, + 31.711524963378906, + 86.4286117553711, + -93.55308532714844, + -58.95903396606445, + 4.348090171813965, + 120.06570434570312, + -10.67849349975586, + -26.549598693847656, + 9.73792839050293, + -88.67774963378906, + 39.89107894897461, + -45.74052047729492, + -28.304336547851562, + 0.6397457122802734 + ], + "type": "float32" + } + }, + { + "name": "add float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -32.34067322728728, + 43.12499227028161, + 78.68874120227329, + -54.4989964261196 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -75.67398834228516, + -100.23863220214844, + -5.877931594848633, + 79.86775207519531, + -22.052398681640625, + -44.58165740966797, + 143.96755981445312, + 4.636482238769531, + 64.86093139648438, + -47.51750946044922, + 45.33852005004883, + 1.3033409118652344, + -107.91262817382812, + -20.841163635253906, + -15.230562210083008, + 138.93667602539062, + 100.57249450683594, + -14.050880432128906, + 106.40779876708984, + 60.46953582763672, + 131.3418426513672, + -124.49354553222656, + -14.67734146118164, + -84.48552703857422 + ], + "type": "float32" + } + }, + { + "name": "add float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + -59.36157224952288 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -43.33331702607182, + -67.89795492110251, + 26.462739729601154, + 36.74276245870831, + -65.1773897660934, + -87.70664817075895, + 65.2788147914111, + -74.05226258410215, + -13.82780997496917, + 6.9814867885681196, + 99.8375201051771, + 55.80233785150233, + -75.57196245651672, + 11.499508337009786, + 17.110109711325364, + 95.81167418402984, + 57.447496690075326, + -57.17587415294769, + 27.71905326607728, + -18.21920899392113, + 52.65309891626177, + -69.9945556346263, + 39.82165678962866, + -29.986529326327684 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -102.69488525390625, + -127.25952911376953, + -32.898834228515625, + -22.61880874633789, + -124.5389633178711, + -147.06822204589844, + 5.917243957519531, + -133.41383361816406, + -73.18938446044922, + -52.38008499145508, + 40.47594451904297, + -3.559234619140625, + -134.93353271484375, + -47.862064361572266, + -42.25146484375, + 36.450103759765625, + -1.9140739440917969, + -116.53744506835938, + -31.642518997192383, + -77.58078002929688, + -6.708473205566406, + -129.3561248779297, + -19.5399169921875, + -89.34809875488281 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/average_pool2d.json b/testing/web-platform/tests/webnn/resources/test_data/average_pool2d.json new file mode 100644 index 0000000000..badcfc888d --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/average_pool2d.json @@ -0,0 +1,1437 @@ +{ + "tests": [ + { + "name": "averagePool2d float32 4D tensor all positive default options", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 47.26926803588867, + 44.72445297241211 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor all negative default options", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + -83.87757731810672, + -2.0740278160840973, + -7.561108501687542, + -45.27426240728714, + -16.366556721916695, + -44.90851354569205, + -42.041864278576966, + -44.77232004469474, + -1.5066278585637178, + -52.65203675020273, + -92.0185617404752, + -48.00409189056276, + -61.522973144977634, + -93.44403784112669, + -25.780331283162965, + -95.51873647896396, + -10.963757774358783, + -59.13274884066298, + -32.601736114443554, + -21.451043477036478, + -87.11596404238824, + -61.326115814276626, + -41.989721754495825, + -87.87648787075247, + -71.69316094374365, + -80.24160387383347, + -97.48886243642632, + -75.89422421069519, + -45.08991580050407, + -88.27134747370127, + -90.71282719640234, + -93.32392100055493, + -59.14753161989912, + -45.331061517612305, + -51.325623691528534, + -31.15479613935011, + -31.624241001643554, + -62.80167996617545, + -63.5585108082942, + -68.96183132099878, + -43.094152045751045, + -15.80344395122441, + -64.31091886555717, + -66.45872774317789, + -42.02725165929741, + -26.032954597038938, + -22.737527779713233, + -70.32036541871405, + -85.28228199042766, + -92.10668232344767 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + -49.258975982666016, + -60.52408981323242 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.windowDimensions", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 43.46498107910156, + 49.37273406982422, + 42.7481689453125, + 50.038944244384766, + 52.452327728271484, + 58.46046447753906, + 32.15948486328125, + 34.75465393066406, + 54.00202560424805, + 49.65404510498047, + 41.824440002441406, + 35.84912109375, + 43.23125457763672, + 37.842769622802734, + 32.67961120605469, + 41.17021942138672, + 42.79708480834961, + 38.987247467041016 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.padding", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "padding": [1, 0, 0, 1] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 52.43666076660156, + 49.84208297729492, + 47.26926803588867, + 46.15715408325195, + 46.63268280029297, + 43.616947174072266, + 44.72445297241211, + 44.05451583862305 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.strides", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 43.46498107910156, + 42.7481689453125, + 32.15948486328125, + 54.00202560424805, + 49.65404510498047, + 35.84912109375, + 41.17021942138672, + 38.987247467041016 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.dilations", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "dilations": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 32.2001838684082, + 42.971012115478516 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.autoPad=explicit", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "padding": [1, 0, 0, 1], + "autoPad": "explicit" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 52.43666076660156, + 49.84208297729492, + 47.26926803588867, + 46.15715408325195, + 46.63268280029297, + 43.616947174072266, + 44.72445297241211, + 44.05451583862305 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.autoPad=same-upper", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 18.669797402066955, + 95.74087629574039, + 24.142204556566483, + 51.13168108230512, + 32.59428648032041, + 36.33802591707573, + 27.143744148346705, + 61.289996123672566, + 0.728295383811961, + 60.81457168719891, + 95.0135160845949, + 65.57073366405261, + 24.878494968304032, + 54.664386232007665, + 26.61406921126077, + 52.134243150024886, + 12.628756510724926, + 83.86613668699508, + 10.754655927067148, + 14.330409913484088, + 29.797547470611676, + 4.38582170135331, + 3.052249580313382, + 22.562494369151654, + 6.22880691096237, + 84.28155043844244, + 11.095604502619949, + 43.65773966541213, + 20.380576521492454, + 94.70740415350079, + 29.785210365576088, + 49.15286022732512 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 43.46503448486328, + 54.04864501953125, + 43.78555679321289, + 59.8331413269043, + 27.34345817565918, + 17.575525283813477, + 41.079856872558594, + 33.422855377197266 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.autoPad=same-lower", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 18.669797402066955, + 95.74087629574039, + 24.142204556566483, + 51.13168108230512, + 32.59428648032041, + 36.33802591707573, + 27.143744148346705, + 61.289996123672566, + 0.728295383811961, + 60.81457168719891, + 95.0135160845949, + 65.57073366405261, + 24.878494968304032, + 54.664386232007665, + 26.61406921126077, + 52.134243150024886, + 12.628756510724926, + 83.86613668699508, + 10.754655927067148, + 14.330409913484088, + 29.797547470611676, + 4.38582170135331, + 3.052249580313382, + 22.562494369151654, + 6.22880691096237, + 84.28155043844244, + 11.095604502619949, + 43.65773966541213, + 20.380576521492454, + 94.70740415350079, + 29.785210365576088, + 49.15286022732512 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 45.83574676513672, + 49.297752380371094, + 35.00300979614258, + 53.28703308105469, + 32.6695671081543, + 23.158628463745117, + 39.963619232177734, + 38.075660705566406 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.autoPad=same-upper ignores options.padding", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 18.669797402066955, + 95.74087629574039, + 24.142204556566483, + 51.13168108230512, + 32.59428648032041, + 36.33802591707573, + 27.143744148346705, + 61.289996123672566, + 0.728295383811961, + 60.81457168719891, + 95.0135160845949, + 65.57073366405261, + 24.878494968304032, + 54.664386232007665, + 26.61406921126077, + 52.134243150024886, + 12.628756510724926, + 83.86613668699508, + 10.754655927067148, + 14.330409913484088, + 29.797547470611676, + 4.38582170135331, + 3.052249580313382, + 22.562494369151654, + 6.22880691096237, + 84.28155043844244, + 11.095604502619949, + 43.65773966541213, + 20.380576521492454, + 94.70740415350079, + 29.785210365576088, + 49.15286022732512 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [2, 2, 2, 2], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 43.46503448486328, + 54.04864501953125, + 43.78555679321289, + 59.8331413269043, + 27.34345817565918, + 17.575525283813477, + 41.079856872558594, + 33.422855377197266 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.autoPad=same-lower ignores options.padding", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 18.669797402066955, + 95.74087629574039, + 24.142204556566483, + 51.13168108230512, + 32.59428648032041, + 36.33802591707573, + 27.143744148346705, + 61.289996123672566, + 0.728295383811961, + 60.81457168719891, + 95.0135160845949, + 65.57073366405261, + 24.878494968304032, + 54.664386232007665, + 26.61406921126077, + 52.134243150024886, + 12.628756510724926, + 83.86613668699508, + 10.754655927067148, + 14.330409913484088, + 29.797547470611676, + 4.38582170135331, + 3.052249580313382, + 22.562494369151654, + 6.22880691096237, + 84.28155043844244, + 11.095604502619949, + 43.65773966541213, + 20.380576521492454, + 94.70740415350079, + 29.785210365576088, + 49.15286022732512 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [2, 2, 2, 2], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 45.83574676513672, + 49.297752380371094, + 35.00300979614258, + 53.28703308105469, + 32.6695671081543, + 23.158628463745117, + 39.963619232177734, + 38.075660705566406 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.layout=nchw", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "layout": "nchw" + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 47.26926803588867, + 44.72445297241211 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.layout=nhwc", + "inputs": { + "input": { + "shape": [1, 5, 5, 2], + "data": [ + 22.975555502750634, + 91.59549689157087, + 78.15438048012338, + 65.64701225681809, + 9.68611138116071, + 55.14215004436653, + 51.29803808129347, + 18.432438840756184, + 32.19308601456918, + 49.34624267439973, + 87.65037289600019, + 15.648024969290454, + 87.25082191311348, + 68.02723372727797, + 39.49793996935087, + 20.342549040418124, + 80.09963591169489, + 26.72794900604616, + 10.220142557736978, + 64.87446829774323, + 52.60270021646585, + 46.56714896227794, + 1.4128639882603933, + 79.57832937136276, + 11.954064466077474, + 4.338463748959498, + 85.0007506374375, + 38.18383968382213, + 64.7837446465813, + 45.253981324455175, + 88.03128735720126, + 80.9717996657439, + 11.333851214909307, + 67.58124910163149, + 70.61659435728073, + 6.026499585657263, + 84.90442561999888, + 29.77881349289366, + 79.06688041781518, + 58.58993337807239, + 7.328724951604215, + 2.2384984647495054, + 35.97796581186121, + 14.505490166700486, + 10.17730631094398, + 68.72449589246624, + 1.4140757517112412, + 76.45657404642184, + 78.10038172113374, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 2], + "data": [ + 47.26926803588867, + 44.72445297241211 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.roundingType=floor", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "floor" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 54.20252990722656, + 37.16582489013672, + 50.038944244384766, + 58.46046447753906, + 52.73374557495117, + 39.1442985534668, + 43.23125457763672, + 32.67961120605469 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.roundingType=ceil", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "ceil" + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 54.20252990722656, + 37.16582489013672, + 21.206613540649414, + 50.038944244384766, + 58.46046447753906, + 51.3569221496582, + 37.24428939819336, + 54.04661178588867, + 78.58363342285156, + 52.73374557495117, + 39.1442985534668, + 57.1103515625, + 43.23125457763672, + 32.67961120605469, + 56.23945999145508, + 40.00800323486328, + 43.85149002075195, + 41.061283111572266 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "floor", + "outputSizes": [3, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 54.20252990722656, + 37.16582489013672, + 21.206613540649414, + 50.038944244384766, + 58.46046447753906, + 51.3569221496582, + 37.24428939819336, + 54.04661178588867, + 78.58363342285156, + 52.73374557495117, + 39.1442985534668, + 57.1103515625, + 43.23125457763672, + 32.67961120605469, + 56.23945999145508, + 40.00800323486328, + 43.85149002075195, + 41.061283111572266 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 22.975555502750634, + 78.15438048012338, + 9.68611138116071, + 51.29803808129347, + 32.19308601456918, + 87.65037289600019, + 87.25082191311348, + 39.49793996935087, + 80.09963591169489, + 10.220142557736978, + 52.60270021646585, + 1.4128639882603933, + 11.954064466077474, + 85.0007506374375, + 64.7837446465813, + 88.03128735720126, + 11.333851214909307, + 70.61659435728073, + 84.90442561999888, + 79.06688041781518, + 7.328724951604215, + 35.97796581186121, + 10.17730631094398, + 1.4140757517112412, + 78.10038172113374, + 91.59549689157087, + 65.64701225681809, + 55.14215004436653, + 18.432438840756184, + 49.34624267439973, + 15.648024969290454, + 68.02723372727797, + 20.342549040418124, + 26.72794900604616, + 64.87446829774323, + 46.56714896227794, + 79.57832937136276, + 4.338463748959498, + 38.18383968382213, + 45.253981324455175, + 80.9717996657439, + 67.58124910163149, + 6.026499585657263, + 29.77881349289366, + 58.58993337807239, + 2.2384984647495054, + 14.505490166700486, + 68.72449589246624, + 76.45657404642184, + 23.53263275794233 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "ceil", + "outputSizes": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 54.20252990722656, + 37.16582489013672, + 50.038944244384766, + 58.46046447753906, + 52.73374557495117, + 39.1442985534668, + 43.23125457763672, + 32.67961120605469 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.dilations with options.strides", + "inputs": { + "input": { + "shape": [1, 7, 7, 2], + "data": [ + 70.71148774443492, + 99.33489815408664, + 76.41767900938127, + 39.409808491208075, + 38.163289750884786, + 45.97125579577395, + 65.35275817451954, + 64.51607308318059, + 7.725966798101558, + 41.76720213197029, + 94.92633986102845, + 53.4757741282748, + 95.46460581561715, + 58.46179617509972, + 15.831390456395834, + 78.41020177955981, + 24.454091426720414, + 20.630917089878963, + 32.06352406991017, + 47.85192144436541, + 91.60813996882193, + 72.3534960877585, + 74.69429879171796, + 28.860215094737086, + 71.82395761056222, + 7.989691677216348, + 88.16659758415284, + 58.6985038368079, + 63.60618868578896, + 55.8818785297152, + 52.80997356964097, + 72.91473981865086, + 46.95766296624579, + 22.102796753895348, + 87.14309482408858, + 89.6496773704621, + 63.1961060394868, + 11.760882769042901, + 70.68730644647478, + 57.704439449166166, + 1.1838214608898001, + 25.26912465963118, + 95.29122935012228, + 1.9658531197579432, + 53.368467017876874, + 21.40085377593268, + 55.86185685082425, + 27.824509095022275, + 7.642839647105948, + 82.34233289843691, + 91.7521616316225, + 62.791557264860565, + 28.11526123625361, + 28.724785838845257, + 29.887035626290203, + 66.43102984451734, + 7.010304526340372, + 34.337018989980514, + 73.20159661759989, + 7.883560316368032, + 17.82563551949343, + 33.79915704452567, + 65.01251297487225, + 30.264028793619268, + 75.76551637076324, + 21.1508003371365, + 60.84249522847649, + 98.56522463801258, + 62.609908350393084, + 42.42991434971615, + 53.142145502626946, + 36.295458325008624, + 79.95863074037406, + 79.6073479374342, + 16.05911470947725, + 19.27552016276064, + 53.930229800491915, + 48.416206270762906, + 93.00965219282095, + 62.08652309606562, + 83.50532824078782, + 61.079643266937, + 75.51439445416229, + 54.19378092928726, + 2.5728738625729886, + 59.476519581318875, + 34.22541363563057, + 13.070153382932116, + 12.419061788136698, + 55.82337008512126, + 4.55381397818555, + 63.4783048068831, + 62.35559240600399, + 56.96109146563499, + 34.770159024929015, + 0.9611224125308793, + 35.306870987826144, + 98.0079011498779 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "autoPad": "explicit", + "strides": [2, 2], + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [1, 3, 3, 2], + "data": [ + 42.940242767333984, + 55.268165588378906, + 51.6013298034668, + 50.220027923583984, + 72.13362884521484, + 41.542198181152344, + 48.91604232788086, + 38.775962829589844, + 61.21329879760742, + 49.504154205322266, + 57.72294998168945, + 38.6922492980957, + 50.19099807739258, + 29.15436363220215, + 52.98439025878906, + 43.10562515258789, + 66.77796936035156, + 55.2725830078125 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/batch_normalization.json b/testing/web-platform/tests/webnn/resources/test_data/batch_normalization.json new file mode 100644 index 0000000000..19f414bbfe --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/batch_normalization.json @@ -0,0 +1,1089 @@ +{ + "tests": [ + { + "name": "batchNormalization float32 2D tensor (mean and variance are non-constant) default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [6], + "data": [ + -7.814267643537363, + -95.6412954353084, + 38.154405424391285, + -55.9520351570133, + -87.8650062484926, + -41.636455304505525 + ], + "type": "float32" + }, + "variance": { + "shape": [6], + "data": [ + 60.311864286118144, + 26.432604504927436, + 53.275636661772396, + 40.146120500534074, + 59.41098289103077, + 35.99981828466932 + ], + "type": "float32" + } + }, + "expected": { + "shape": [4, 6], + "data": [ + -4.312741756439209, + 31.068212509155273, + -13.910240173339844, + 1.4459478855133057, + 22.170541763305664, + -6.407354354858398, + -6.995829105377197, + 18.583200454711914, + -10.831125259399414, + 17.820920944213867, + 16.2480411529541, + 16.447195053100586, + 11.57226848602295, + 1.8526301383972168, + 5.306026458740234, + 24.145092010498047, + 8.629376411437988, + -9.216986656188965, + -0.1989477425813675, + 34.203548431396484, + -16.923160552978516, + 18.671411514282227, + 2.5159497261047363, + 4.921559810638428 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [6], + "data": [ + -7.814267643537363, + -95.6412954353084, + 38.154405424391285, + -55.9520351570133, + -87.8650062484926, + -41.636455304505525 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [6], + "data": [ + 60.311864286118144, + 26.432604504927436, + 53.275636661772396, + 40.146120500534074, + 59.41098289103077, + 35.99981828466932 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [4, 6], + "data": [ + -4.312741756439209, + 31.068212509155273, + -13.910240173339844, + 1.4459478855133057, + 22.170541763305664, + -6.407354354858398, + -6.995829105377197, + 18.583200454711914, + -10.831125259399414, + 17.820920944213867, + 16.2480411529541, + 16.447195053100586, + 11.57226848602295, + 1.8526301383972168, + 5.306026458740234, + 24.145092010498047, + 8.629376411437988, + -9.216986656188965, + -0.1989477425813675, + 34.203548431396484, + -16.923160552978516, + 18.671411514282227, + 2.5159497261047363, + 4.921559810638428 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 12.810381162337634, + 63.13715247590298, + -61.6298331266107 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 18.35824023925998, + 41.847234441124506, + 16.128282835364406 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [2, 3, 4], + "data": [ + -12.630594253540039, + 11.967890739440918, + -17.781383514404297, + -13.910285949707031, + 3.0739352703094482, + -22.139259338378906, + -19.36661148071289, + -9.775517463684082, + 5.161267280578613, + 29.53006935119629, + 24.651947021484375, + 29.550840377807617, + 16.161500930786133, + -23.088642120361328, + 14.954023361206055, + 19.656957626342773, + -13.06058406829834, + -24.745210647583008, + -11.206846237182617, + 2.638929843902588, + -5.910898208618164, + 30.871898651123047, + -1.7038332223892212, + 12.331327438354492 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + -16.842504501342773, + 2.2579827308654785, + -20.842041015625, + -17.836172103881836, + -1.7581257820129395, + -19.30902862548828, + -17.37898826599121, + -10.702629089355469, + 6.4271392822265625, + 17.812623977661133, + 15.533489227294922, + 17.822328567504883, + 5.514280319213867, + -24.963077545166016, + 4.576685905456543, + 8.228469848632812, + -12.989363670349121, + -21.123029708862305, + -11.698976516723633, + -2.0609331130981445, + 1.2540507316589355, + 18.43954849243164, + 3.2196571826934814, + 9.777103424072266 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 5D tensor default options", + "inputs": { + "input": { + "shape": [6, 1, 1, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [1], + "data": [ + 35.407824570198215 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [1], + "data": [ + 40.931099315280846 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [6, 1, 1, 2, 2], + "data": [ + -11.990972518920898, + 4.4829583168029785, + -15.440524101257324, + -12.847999572753906, + 7.442382335662842, + -18.051416397094727, + -15.247910499572754, + -5.550075531005859, + -11.927642822265625, + 3.369194269180298, + 0.30708834528923035, + 3.382232427597046, + 7.291474342346191, + -18.99486541748047, + 6.4828104972839355, + 9.632428169250488, + -8.871702194213867, + -20.686368942260742, + -6.99733304977417, + 7.002535343170166, + -18.877885818481445, + 4.211489677429199, + -16.237018585205078, + -7.42683744430542 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NCHW tensor options.axis=1", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "axis": 1 + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + -16.842504501342773, + 2.2579827308654785, + -20.842041015625, + -17.836172103881836, + -1.7581257820129395, + -19.30902862548828, + -17.37898826599121, + -10.702629089355469, + 6.4271392822265625, + 17.812623977661133, + 15.533489227294922, + 17.822328567504883, + 5.514280319213867, + -24.963077545166016, + 4.576685905456543, + 8.228469848632812, + -12.989363670349121, + -21.123029708862305, + -11.698976516723633, + -2.0609331130981445, + 1.2540507316589355, + 18.43954849243164, + 3.2196571826934814, + 9.777103424072266 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NHWC tensor options.axis=3", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -41.30732967168238, + 83.0222726565018, + -40.902161220312074, + 64.08864045143429, + -80.08049213079853, + 56.963061967558474, + -63.376671841233104, + -62.144380499565784, + 37.37249789808206, + -46.7903680211994, + -0.10012771650340824, + 57.04647733193906, + 82.05679802728304, + -21.35103988063949, + -85.36802529512583, + -86.11642850667623, + -96.93823797160586, + 62.35185227095363, + 76.88317547014259, + -9.359310262561493, + -68.4724340974042, + 97.03362133579051, + 80.2082435478892, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "axis": 3 + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + -16.842504501342773, + -1.7581257820129395, + 6.4271392822265625, + 2.2579827308654785, + -19.30902862548828, + 17.812623977661133, + -20.842041015625, + -17.37898826599121, + 15.533489227294922, + -17.836172103881836, + -10.702629089355469, + 17.822328567504883, + 5.514280319213867, + -12.989363670349121, + 1.2540507316589355, + -24.963077545166016, + -21.123029708862305, + 18.43954849243164, + 4.576685905456543, + -11.698976516723633, + 3.2196571826934814, + 8.228469848632812, + -2.0609331130981445, + 9.777103424072266 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NCHW tensor options.scale", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "scale": { + "shape": [3], + "data": [ + 65.50171582968795, + -71.00757080938772, + -5.569730877611249 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + -1103.212890625, + 147.90174865722656, + -1365.189453125, + -1168.2999267578125, + 124.84024047851562, + 1371.087158203125, + 1234.0396728515625, + 759.9676513671875, + -35.79743576049805, + -99.2115249633789, + -86.51734924316406, + -99.26557159423828, + 361.19482421875, + -1635.1243896484375, + 299.78076171875, + 538.9788818359375, + 922.3430786132812, + 1499.89501953125, + 830.7158813476562, + 146.3418426513672, + -6.984724998474121, + -102.70331573486328, + -17.9326229095459, + -54.455833435058594 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NCHW tensor options.bias", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bias": { + "shape": [3], + "data": [ + 64.20446782594775, + 75.28591851497856, + -84.57243127763437 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + 47.36196517944336, + 66.46244812011719, + 43.3624267578125, + 46.36829376220703, + 73.52779388427734, + 55.976890563964844, + 57.90693283081055, + 64.58329010009766, + -78.14529418945312, + -66.75981140136719, + -69.03894805908203, + -66.75010681152344, + 69.71875, + 39.241390228271484, + 68.7811508178711, + 72.43293762207031, + 62.29655456542969, + 54.16288757324219, + 63.586944580078125, + 73.22498321533203, + -83.3183822631836, + -66.13288879394531, + -81.35277557373047, + -74.79533386230469 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NCHW tensor options.epsilon", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "epsilon": 1e-6 // A small value to prevent computational error due to divide-by-zero. + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + -16.842506408691406, + 2.2579832077026367, + -20.842044830322266, + -17.8361759185791, + -1.758125901222229, + -19.309030532836914, + -17.37898826599121, + -10.702629089355469, + 6.427139759063721, + 17.812625885009766, + 15.533490180969238, + 17.822330474853516, + 5.514281272888184, + -24.96308135986328, + 4.576686382293701, + 8.228470802307129, + -12.989363670349121, + -21.123031616210938, + -11.698976516723633, + -2.0609331130981445, + 1.254050850868225, + 18.43954849243164, + 3.2196574211120605, + 9.777103424072266 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NCHW tensor options.activation relu", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -41.30732967168238, + 64.08864045143429, + -63.376671841233104, + -46.7903680211994, + 83.0222726565018, + -80.08049213079853, + -62.144380499565784, + -0.10012771650340824, + -40.902161220312074, + 56.963061967558474, + 37.37249789808206, + 57.04647733193906, + 82.05679802728304, + -86.11642850667623, + 76.88317547014259, + 97.03362133579051, + -21.35103988063949, + -96.93823797160586, + -9.359310262561493, + 80.2082435478892, + -85.36802529512583, + 62.35185227095363, + -68.4724340974042, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "activation": "relu" + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + 0, + 2.2579827308654785, + 0, + 0, + 0, + 0, + 0, + 0, + 6.4271392822265625, + 17.812623977661133, + 15.533489227294922, + 17.822328567504883, + 5.514280319213867, + 0, + 4.576685905456543, + 8.228469848632812, + 0, + 0, + 0, + 0, + 1.2540507316589355, + 18.43954849243164, + 3.2196571826934814, + 9.777103424072266 + ], + "type": "float32" + } + }, + { + "name": "batchNormalization float32 4D NHWC tensor all options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -41.30732967168238, + 83.0222726565018, + -40.902161220312074, + 64.08864045143429, + -80.08049213079853, + 56.963061967558474, + -63.376671841233104, + -62.144380499565784, + 37.37249789808206, + -46.7903680211994, + -0.10012771650340824, + 57.04647733193906, + 82.05679802728304, + -21.35103988063949, + -85.36802529512583, + -86.11642850667623, + -96.93823797160586, + 62.35185227095363, + 76.88317547014259, + -9.359310262561493, + -68.4724340974042, + 97.03362133579051, + 80.2082435478892, + -12.107167478351585 + ], + "type": "float32" + }, + "mean": { + "shape": [3], + "data": [ + 51.62914995931095, + 99.36075401019252, + -96.14736495234415 + ], + "type": "float32", + "constant": true + }, + "variance": { + "shape": [3], + "data": [ + 30.448016067921067, + 86.36218998771075, + 73.88454888724165 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "scale": { + "shape": [3], + "data": [ + 65.50171582968795, + -71.00757080938772, + -5.569730877611249 + ], + "type": "float32" + }, + "bias": { + "shape": [3], + "data": [ + 64.20446782594775, + 75.28591851497856, + -84.57243127763437 + ], + "type": "float32" + }, + "axis": 3, + "epsilon": 1e-6, + "activation": "relu" + }, + "expected": { + "shape": [2, 3, 2, 2], + "data": [ + 0, + 200.12615966796875, + 0, + 212.10623168945312, + 1446.3731689453125, + 0, + 0, + 1309.32568359375, + 0, + 0, + 835.2536010742188, + 0, + 425.39935302734375, + 997.6290893554688, + 0, + 0, + 1575.1810302734375, + 0, + 363.98529052734375, + 906.0018310546875, + 0, + 603.1834106445312, + 221.62777709960938, + 0 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/ceil.json b/testing/web-platform/tests/webnn/resources/test_data/ceil.json new file mode 100644 index 0000000000..6fa623977f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/ceil.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "ceil float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 67.38941577648342, + 36.78218646695805, + 99.10649131558534, + -22.587103876323283, + 32.70173557917525, + 17.688807510873474, + 5.631034848468943, + 12.965238190762022, + 83.1319330049133, + -29.29246123472926, + 19.844631250887133, + 65.27903232818329, + 26.311109519759952, + 24.2856723456172, + -48.3976724829041, + -5.617412380605998, + 61.53380759105448, + -87.81197726868459, + 69.71428621372127, + 5.0031021954943355, + 84.3683411023199, + -9.390542062321572, + -27.85661776414834, + -34.89593295662057 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 68, + 37, + 100, + -22, + 33, + 18, + 6, + 13, + 84, + -29, + 20, + 66, + 27, + 25, + -48, + -5, + 62, + -87, + 70, + 6, + 85, + -9, + -27, + -34 + ], + "type": "float32" + } + }, + { + "name": "ceil float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 67.38941577648342, + 36.78218646695805, + 99.10649131558534, + -22.587103876323283, + 32.70173557917525, + 17.688807510873474, + 5.631034848468943, + 12.965238190762022, + 83.1319330049133, + -29.29246123472926, + 19.844631250887133, + 65.27903232818329, + 26.311109519759952, + 24.2856723456172, + -48.3976724829041, + -5.617412380605998, + 61.53380759105448, + -87.81197726868459, + 69.71428621372127, + 5.0031021954943355, + 84.3683411023199, + -9.390542062321572, + -27.85661776414834, + -34.89593295662057 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 68, + 37, + 100, + -22, + 33, + 18, + 6, + 13, + 84, + -29, + 20, + 66, + 27, + 25, + -48, + -5, + 62, + -87, + 70, + 6, + 85, + -9, + -27, + -34 + ], + "type": "float32" + } + }, + { + "name": "ceil float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 67.38941577648342, + 36.78218646695805, + 99.10649131558534, + -22.587103876323283, + 32.70173557917525, + 17.688807510873474, + 5.631034848468943, + 12.965238190762022, + 83.1319330049133, + -29.29246123472926, + 19.844631250887133, + 65.27903232818329, + 26.311109519759952, + 24.2856723456172, + -48.3976724829041, + -5.617412380605998, + 61.53380759105448, + -87.81197726868459, + 69.71428621372127, + 5.0031021954943355, + 84.3683411023199, + -9.390542062321572, + -27.85661776414834, + -34.89593295662057 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 68, + 37, + 100, + -22, + 33, + 18, + 6, + 13, + 84, + -29, + 20, + 66, + 27, + 25, + -48, + -5, + 62, + -87, + 70, + 6, + 85, + -9, + -27, + -34 + ], + "type": "float32" + } + }, + { + "name": "ceil float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 67.38941577648342, + 36.78218646695805, + 99.10649131558534, + -22.587103876323283, + 32.70173557917525, + 17.688807510873474, + 5.631034848468943, + 12.965238190762022, + 83.1319330049133, + -29.29246123472926, + 19.844631250887133, + 65.27903232818329, + 26.311109519759952, + 24.2856723456172, + -48.3976724829041, + -5.617412380605998, + 61.53380759105448, + -87.81197726868459, + 69.71428621372127, + 5.0031021954943355, + 84.3683411023199, + -9.390542062321572, + -27.85661776414834, + -34.89593295662057 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 68, + 37, + 100, + -22, + 33, + 18, + 6, + 13, + 84, + -29, + 20, + 66, + 27, + 25, + -48, + -5, + 62, + -87, + 70, + 6, + 85, + -9, + -27, + -34 + ], + "type": "float32" + } + }, + { + "name": "ceil float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 67.38941577648342, + 36.78218646695805, + 99.10649131558534, + -22.587103876323283, + 32.70173557917525, + 17.688807510873474, + 5.631034848468943, + 12.965238190762022, + 83.1319330049133, + -29.29246123472926, + 19.844631250887133, + 65.27903232818329, + 26.311109519759952, + 24.2856723456172, + -48.3976724829041, + -5.617412380605998, + 61.53380759105448, + -87.81197726868459, + 69.71428621372127, + 5.0031021954943355, + 84.3683411023199, + -9.390542062321572, + -27.85661776414834, + -34.89593295662057 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 68, + 37, + 100, + -22, + 33, + 18, + 6, + 13, + 84, + -29, + 20, + 66, + 27, + 25, + -48, + -5, + 62, + -87, + 70, + 6, + 85, + -9, + -27, + -34 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/clamp.json b/testing/web-platform/tests/webnn/resources/test_data/clamp.json new file mode 100644 index 0000000000..93ab5ca0c1 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/clamp.json @@ -0,0 +1,1102 @@ +{ + "tests": [ + // default options + { + "name": "clamp float32 1D tensor default options", + "inputs": { + "x": { // use 'x' for input operand name + "shape": [24], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1.537420630455017, + -7.34310245513916, + 7.880751132965088, + -2.0564088821411133, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 9.280223846435547, + -2.3130595684051514, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -2.123614549636841 + ], + "type": "float32" + } + }, + { + "name": "clamp float32 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1.537420630455017, + -7.34310245513916, + 7.880751132965088, + -2.0564088821411133, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 9.280223846435547, + -2.3130595684051514, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -2.123614549636841 + ], + "type": "float32" + } + }, + { + "name": "clamp float32 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1.537420630455017, + -7.34310245513916, + 7.880751132965088, + -2.0564088821411133, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 9.280223846435547, + -2.3130595684051514, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -2.123614549636841 + ], + "type": "float32" + } + }, + { + "name": "clamp float32 4D tensor default options", + "inputs": { + "x": { + "shape": [3, 2, 2, 2], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 2, 2, 2], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1.537420630455017, + -7.34310245513916, + 7.880751132965088, + -2.0564088821411133, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 9.280223846435547, + -2.3130595684051514, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -2.123614549636841 + ], + "type": "float32" + } + }, + { + "name": "clamp float32 5D tensor default options", + "inputs": { + "x": { + "shape": [4, 1, 1, 2, 3], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 1, 1, 2, 3], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1.537420630455017, + -7.34310245513916, + 7.880751132965088, + -2.0564088821411133, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 9.280223846435547, + -2.3130595684051514, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -2.123614549636841 + ], + "type": "float32" + } + }, + // default options.maxValue and specified options.minValue + { + "name": "clamp float32 4D tensor default options.maxValue and specified negative options.minValue", + "inputs": { + "x": { + "shape": [2, 1, 4, 3], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -1, + -1, + -1, + -1, + -1, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + -1, + -1, + 7.880751132965088, + -1, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + -1, + -1, + 9.280223846435547, + -1, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + -1 + ], + "type": "float32" + }, + "options": { + "minValue": -1.0 + } + }, + { + "name": "clamp float32 3D tensor default options.maxValue and specified options.minValue=0.0", + "inputs": { + "x": { + "shape": [6, 2, 2], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [6, 2, 2], + "data": [ + 0, + 0, + 0, + 0, + 0, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + 0, + 0, + 7.880751132965088, + 0, + 6.3438639640808105, + 5.525737762451172, + 0.8433118462562561, + 0, + 0, + 9.280223846435547, + 0, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + 0 + ], + "type": "float32" + }, + "options": { + "minValue": 0.0 + } + }, + { + "name": "clamp float32 2D tensor default options.maxValue and specified positive options.minValue", + "inputs": { + "x": { + "shape": [3, 8], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 8], + "data": [ + 1, + 1, + 1, + 1, + 1, + 9.524681091308594, + 3.7292487621307373, + 6.481687068939209, + 1, + 1, + 7.880751132965088, + 1, + 6.3438639640808105, + 5.525737762451172, + 1, + 1, + 1, + 9.280223846435547, + 1, + 9.549695014953613, + 5.788925647735596, + 5.549378395080566, + 7.409400463104248, + 1 + ], + "type": "float32" + }, + "options": { + "minValue": 1.0 + } + }, + // default options.minValue and specified options.maxValue + { + "name": "clamp float32 5D tensor default options.minValue and specified negative options.maxValue", + "inputs": { + "x": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + -2, + -2, + -2, + -2, + -7.34310245513916, + -2, + -2.0564088821411133, + -2, + -2, + -2, + -8.199960708618164, + -7.786487102508545, + -2, + -2.3130595684051514, + -2, + -2, + -2, + -2, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "maxValue": -2.0 + } + }, + { + "name": "clamp float32 1D tensor default options.minValue and specified options.maxValue=0.0", + "inputs": { + "x": { + "shape": [24], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 0, + 0, + 0, + -1.537420630455017, + -7.34310245513916, + 0, + -2.0564088821411133, + 0, + 0, + 0, + -8.199960708618164, + -7.786487102508545, + 0, + -2.3130595684051514, + 0, + 0, + 0, + 0, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "maxValue": 0.0 + } + }, + { + "name": "clamp float32 3D tensor default options.minValue and specified positive options.maxValue", + "inputs": { + "x": { + "shape": [3, 4, 2], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 4, 2], + "data": [ + -9.817828178405762, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + 3, + 3, + 3, + -1.537420630455017, + -7.34310245513916, + 3, + -2.0564088821411133, + 3, + 3, + 0.8433118462562561, + -8.199960708618164, + -7.786487102508545, + 3, + -2.3130595684051514, + 3, + 3, + 3, + 3, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "maxValue": 3.0 + } + }, + // specified both options.minValue and options.maxValue + { + "name": "clamp float32 5D tensor specified both negative options.minValue and options.maxValue", + "inputs": { + "x": { + "shape": [3, 2, 1, 1, 4], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 2, 1, 1, 4], + "data": [ + -8, + -6.024064064025879, + -4.0725626945495605, + -6.575078010559082, + -7.755683898925781, + -1, + -1, + -1, + -1.537420630455017, + -7.34310245513916, + -1, + -2.0564088821411133, + -1, + -1, + -1, + -8, + -7.786487102508545, + -1, + -2.3130595684051514, + -1, + -1, + -1, + -1, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "minValue": -8.0, + "maxValue": -1.0 + } + }, + { + "name": "clamp float32 4D tensor specified negative options.minValue and options.maxValue=0.0", + "inputs": { + "x": { + "shape": [1, 4, 3, 2], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 4, 3, 2], + "data": [ + -6, + -6, + -4.0725626945495605, + -6, + -6, + 0, + 0, + 0, + -1.537420630455017, + -6, + 0, + -2.0564088821411133, + 0, + 0, + 0, + -6, + -6, + 0, + -2.3130595684051514, + 0, + 0, + 0, + 0, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "minValue": -6.0, + "maxValue": 0.0 + } + }, + { + "name": "clamp float32 3D tensor specified negative options.minValue and positive options.maxValue", + "inputs": { + "x": { + "shape": [2, 6, 2], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 6, 2], + "data": [ + -3, + -3, + -3, + -3, + -3, + 4, + 3.7292487621307373, + 4, + -1.537420630455017, + -3, + 4, + -2.0564088821411133, + 4, + 4, + 0.8433118462562561, + -3, + -3, + 4, + -2.3130595684051514, + 4, + 4, + 4, + 4, + -2.123614549636841 + ], + "type": "float32" + }, + "options": { + "minValue": -3.0, + "maxValue": 4.0 + } + }, + { + "name": "clamp float32 2D tensor specified options.minValue=0.0 and positive options.maxValue", + "inputs": { + "x": { + "shape": [6, 4], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [6, 4], + "data": [ + 0, + 0, + 0, + 0, + 0, + 6, + 3.7292487621307373, + 6, + 0, + 0, + 6, + 0, + 6, + 5.525737762451172, + 0.8433118462562561, + 0, + 0, + 6, + 0, + 6, + 5.788925647735596, + 5.549378395080566, + 6, + 0 + ], + "type": "float32" + }, + "options": { + "minValue": 0.0, + "maxValue": 6.0 + } + }, + { + "name": "clamp float32 1D tensor specified both positive options.minValue and options.maxValue", + "inputs": { + "x": { + "shape": [24], + "data": [ + -9.817828475355284, + -6.024063916325786, + -4.072562498632983, + -6.575078191902692, + -7.7556836912181915, + 9.524681107378463, + 3.7292487446449307, + 6.4816868736447475, + -1.5374205904252634, + -7.343102426698445, + 7.880751290929794, + -2.056408790509967, + 6.34386375786449, + 5.52573787183, + 0.8433118207347725, + -8.19996033345526, + -7.786487326213716, + 9.280223823954241, + -2.31305948485121, + 9.549695091037119, + 5.788925460130297, + 5.549378312916486, + 7.409400528051194, + -2.1236145770503745 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 2, + 2, + 2, + 2, + 2, + 7, + 3.7292487621307373, + 6.481687068939209, + 2, + 2, + 7, + 2, + 6.3438639640808105, + 5.525737762451172, + 2, + 2, + 2, + 7, + 2, + 7, + 5.788925647735596, + 5.549378395080566, + 7, + 2 + ], + "type": "float32" + }, + "options": { + "minValue": 2.0, + "maxValue": 7.0 + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/concat.json b/testing/web-platform/tests/webnn/resources/test_data/concat.json new file mode 100644 index 0000000000..9ecc393f89 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/concat.json @@ -0,0 +1,1799 @@ +{ + "tests": [ + // concat 1D tensors + { + "name": "concat two float32 1D tensors of same shape along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [12], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [12], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 1D tensors of different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [4], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [8], + "data": [ + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [12], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 1D tensors of same 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [6], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [6], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [6], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [6], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 1D tensors of different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [2], + "data": [ + -0.39444134019222243, + 0.8619825316530809 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [4], + "data": [ + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [8], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [10], + "data": [ + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + // concat 2D tensors + { + "name": "concat two float32 2D tensors of same shape along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [2, 6], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [2, 6], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat two float32 2D tensors of same others dimensions except different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [1, 6], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 6], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 2D tensors of same shape along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [3, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [3, 2], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [3, 2], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [12, 2], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat two float32 2D tensors of same others dimensions except different 2nd dimension along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [2, 10], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [2, 2], + "data": [ + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [2, 12], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + 0.5182055234909058, + -0.8742017149925232, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 2D tensors of same shape along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [4, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [4, 2], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [4, 2], + "data": [ + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.3944413363933563, + 0.861982524394989, + -0.5945112705230713, + -0.402848482131958, + -0.7206121683120728, + -0.7993468642234802, + 0.337996244430542, + -0.990639865398407, + -0.9531654119491577, + -0.6731740236282349, + 0.6653800010681152, + 0.03886038810014725, + 0.576785683631897, + 0.32276400923728943, + 0.49189892411231995, + -0.15864109992980957, + 0.5182055234909058, + -0.8742017149925232, + -0.44735023379325867, + 0.11028251051902771, + -0.3418811559677124, + -0.9158143401145935, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 2D tensors of same others dimensions except different 2nd dimension along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [3, 1], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 2], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [3, 2], + "data": [ + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [3, 3], + "data": [ + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [3, 8], + "data": [ + -0.3944413363933563, + -0.990639865398407, + 0.576785683631897, + -0.402848482131958, + -0.9531654119491577, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.861982524394989, + 0.32276400923728943, + -0.44735023379325867, + -0.6731740236282349, + 0.49189892411231995, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + 0.337996244430542, + 0.11028251051902771, + -0.5945112705230713, + -0.15864109992980957, + -0.3418811559677124, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + // concat 3D tensors + { + "name": "concat two float32 3D tensors of same others dimensions except different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [2, 1, 3], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [6, 1, 3], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [8, 1, 3], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 3D tensors of same others dimensions except different 2nd dimension along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [3, 1, 1], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 2, 1], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [3, 2, 1], + "data": [ + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [3, 3, 1], + "data": [ + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [3, 8, 1], + "data": [ + -0.3944413363933563, + -0.990639865398407, + 0.576785683631897, + -0.402848482131958, + -0.9531654119491577, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.861982524394989, + 0.32276400923728943, + -0.44735023379325867, + -0.6731740236282349, + 0.49189892411231995, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + 0.337996244430542, + 0.11028251051902771, + -0.5945112705230713, + -0.15864109992980957, + -0.3418811559677124, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 3D tensors of same shape along axis 2", + "inputs": [ + { + "name": "input1", + "shape": [2, 2, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [2, 2, 2], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [2, 2, 2], + "data": [ + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [2, 2, 6], + "data": [ + -0.3944413363933563, + 0.861982524394989, + -0.5945112705230713, + -0.402848482131958, + -0.7206121683120728, + -0.7993468642234802, + 0.337996244430542, + -0.990639865398407, + -0.9531654119491577, + -0.6731740236282349, + 0.6653800010681152, + 0.03886038810014725, + 0.576785683631897, + 0.32276400923728943, + 0.49189892411231995, + -0.15864109992980957, + 0.5182055234909058, + -0.8742017149925232, + -0.44735023379325867, + 0.11028251051902771, + -0.3418811559677124, + -0.9158143401145935, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + // concat 4D tensors + { + "name": "concat two float32 4D tensors of same others dimensions except different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [1, 3, 1, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 3, 1, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 3, 1, 2], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 4D tensors of same shape along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [2, 2, 1, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [2, 2, 1, 2], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [2, 2, 1, 2], + "data": [ + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [2, 6, 1, 2], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 4D tensors of same others dimensions except different 3rd dimension along axis 2", + "inputs": [ + { + "name": "input1", + "shape": [1, 2, 2, 1], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 2, 8, 1], + "data": [ + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [1, 2, 2, 1], + "data": [ + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [1, 2, 12, 1], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.5182055234909058, + -0.8742017149925232, + 0.337996244430542, + -0.990639865398407, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat four float32 4D tensors of same others dimensions except different 4th dimension along axis 3", + "inputs": [ + { + "name": "input1", + "shape": [1, 3, 1, 1], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 3, 1, 1], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [1, 3, 1, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input4", + "shape": [1, 3, 1, 4], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 3, + "expected": { + "name": "output", + "shape": [1, 3, 1, 8], + "data": [ + -0.3944413363933563, + -0.990639865398407, + -0.44735023379325867, + 0.11028251051902771, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + 0.861982524394989, + 0.576785683631897, + -0.5945112705230713, + -0.402848482131958, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.337996244430542, + 0.32276400923728943, + -0.9531654119491577, + -0.6731740236282349, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + // concat 5D tensors + { + "name": "concat four float32 5D tensors of same shape along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [1, 2, 1, 1, 3], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 2, 1, 1, 3], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [1, 2, 1, 1, 3], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float32" + }, + { + "name": "input4", + "shape":[1, 2, 1, 1, 3], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 2, 1, 1, 3], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat two float32 5D tensors of same others dimensions except different 2nd dimension along axis 1", + "inputs": [ + { + "name": "input1", + "shape": [1, 2, 3, 1, 1], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 6, 3, 1, 1], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [1, 8, 3, 1, 1], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat three float32 5D tensors of same others dimensions except different 3rd dimension along axis 2", + "inputs": [ + { + "name": "input1", + "shape": [1, 2, 1, 1, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 2, 2, 1, 2], + "data": [ + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float32" + }, + { + "name": "input3", + "shape": [1, 2, 3, 1, 2], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [1, 2, 6, 1, 2], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.337996244430542, + -0.990639865398407, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat two float32 5D tensors of same others dimensions except different 4th dimension along axis 3", + "inputs": [ + { + "name": "input1", + "shape": [3, 1, 1, 1, 2], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [3, 1, 1, 3, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 3, + "expected": { + "name": "output", + "shape": [3, 1, 1, 4, 2], + "data": [ + -0.3944413363933563, + 0.861982524394989, + -0.44735023379325867, + 0.11028251051902771, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.337996244430542, + -0.990639865398407, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + -0.7206121683120728, + -0.7993468642234802, + 0.576785683631897, + 0.32276400923728943, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + }, + { + "name": "concat two float32 5D tensors of same others dimensions except different 5th dimension along axis 4", + "inputs": [ + { + "name": "input1", + "shape": [1, 2, 1, 1, 4], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932 + ], + "type": "float32" + }, + { + "name": "input2", + "shape": [1, 2, 1, 1, 8], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float32" + } + ], + "axis": 4, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1, 12], + "data": [ + -0.3944413363933563, + 0.861982524394989, + 0.337996244430542, + -0.990639865398407, + -0.5945112705230713, + -0.402848482131958, + -0.9531654119491577, + -0.6731740236282349, + 0.49189892411231995, + -0.15864109992980957, + -0.3418811559677124, + -0.9158143401145935, + 0.576785683631897, + 0.32276400923728943, + -0.44735023379325867, + 0.11028251051902771, + -0.7206121683120728, + -0.7993468642234802, + 0.6653800010681152, + 0.03886038810014725, + 0.5182055234909058, + -0.8742017149925232, + -0.4790218770503998, + 0.1211843192577362 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/conv2d.json b/testing/web-platform/tests/webnn/resources/test_data/conv2d.json new file mode 100644 index 0000000000..850897df4e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/conv2d.json @@ -0,0 +1,2144 @@ +{ + "tests": [ + { + "name": "conv2d float32 4D input and filter(non-constant) tensors default options", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 1, 3, 3], + "data": [ + 1.5323282480239868, + 1.3573521375656128, + 1.3641656637191772, + 1.071682333946228, + 1.1259644031524658, + 1.4713115692138672, + 1.078782320022583, + 1.155018925666809, + 1.656954288482666 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors default options", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [1, 1, 3, 3], + "data": [ + 1.5323282480239868, + 1.3573521375656128, + 1.3641656637191772, + 1.071682333946228, + 1.1259644031524658, + 1.4713115692138672, + 1.078782320022583, + 1.155018925666809, + 1.656954288482666 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.padding", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1] + }, + "expected": { + "name": "output", + "shape": [1, 1, 5, 5], + "data": [ + 1.0390141010284424, + 0.882753312587738, + 1.0667248964309692, + 0.8146538734436035, + 0.6772860884666443, + 1.0540467500686646, + 1.5323282480239868, + 1.3573521375656128, + 1.3641656637191772, + 1.1969101428985596, + 0.8080586791038513, + 1.071682333946228, + 1.1259644031524658, + 1.4713115692138672, + 0.960464596748352, + 0.5888903141021729, + 1.078782320022583, + 1.155018925666809, + 1.656954288482666, + 1.2012416124343872, + 0.3167303800582886, + 0.7545653581619263, + 0.7729666829109192, + 0.9733180403709412, + 0.9025675058364868 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.strides", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 1, 2, 2], + "data": [ + 1.5323282480239868, + 1.3641656637191772, + 1.078782320022583, + 1.656954288482666 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.dilations", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "dilations": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 1.3599307537078857 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.padding and options.autoPad='explicit'", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1], + "autoPad": "explicit" + }, + "expected": { + "name": "output", + "shape": [1, 1, 5, 5], + "data": [ + 1.0390141010284424, + 0.882753312587738, + 1.0667248964309692, + 0.8146538734436035, + 0.6772860884666443, + 1.0540467500686646, + 1.5323282480239868, + 1.3573521375656128, + 1.3641656637191772, + 1.1969101428985596, + 0.8080586791038513, + 1.071682333946228, + 1.1259644031524658, + 1.4713115692138672, + 0.960464596748352, + 0.5888903141021729, + 1.078782320022583, + 1.155018925666809, + 1.656954288482666, + 1.2012416124343872, + 0.3167303800582886, + 0.7545653581619263, + 0.7729666829109192, + 0.9733180403709412, + 0.9025675058364868 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.autoPad='same-upper'", + "inputs": { + "input": { + "shape": [1, 1, 4, 4], + "data": [ + 0.9371488026117993, + 0.4742464662522563, + 0.6571340852996714, + 0.8399660616881559, + 0.3286228380482863, + 0.09911389391233816, + 0.008774675079729732, + 0.49592297038960576, + 0.6906991955372042, + 0.40363236211387643, + 0.08385655421112803, + 0.7818648489403492, + 0.7862677667715321, + 0.8178903833064657, + 0.9872956148300345, + 0.1289262831549154 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 1, 2, 2], + "data": [ + 1.298113465309143, + 1.0491873025894165, + 1.475350260734558, + 0.8507925271987915 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.autoPad='same-upper' ignores options.padding", + "inputs": { + "input": { + "shape": [1, 1, 4, 4], + "data": [ + 0.9371488026117993, + 0.4742464662522563, + 0.6571340852996714, + 0.8399660616881559, + 0.3286228380482863, + 0.09911389391233816, + 0.008774675079729732, + 0.49592297038960576, + 0.6906991955372042, + 0.40363236211387643, + 0.08385655421112803, + 0.7818648489403492, + 0.7862677667715321, + 0.8178903833064657, + 0.9872956148300345, + 0.1289262831549154 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 2, 1, 2], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 1, 2, 2], + "data": [ + 1.298113465309143, + 1.0491873025894165, + 1.475350260734558, + 0.8507925271987915 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.autoPad='same-lower'", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 1, 3, 3], + "data": [ + 1.0390141010284424, + 1.0667248964309692, + 0.6772860884666443, + 0.8080586791038513, + 1.1259644031524658, + 0.960464596748352, + 0.3167303800582886, + 0.7729666829109192, + 0.9025675058364868 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.autoPad='same-lower' ignores options.padding", + "inputs": { + "input": { + "shape": [1, 1, 5, 5], + "data": [ + 0.6124474607869732, + 0.8857858599952035, + 0.13667134799354397, + 0.564529098909835, + 0.8965171985225997, + 0.36792828664768873, + 0.6811466319147079, + 0.04795110047019757, + 0.33355462154327986, + 0.19882695924603588, + 0.4116714070095846, + 0.07934240242135737, + 0.42724633975875426, + 0.5358005687699703, + 0.5910805999797129, + 0.2841543363273238, + 0.414725865128835, + 0.026906268886554896, + 0.3621256577250671, + 0.9945681862504354, + 0.07184549434969778, + 0.1220437231354885, + 0.8422137325421886, + 0.4537501021068471, + 0.2152944303497728 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3804761331189006, + 0.5280312082437455, + 0.2194703660873738, + 0.3668976886827289, + 0.33974137307686836, + 0.42000596251782674, + 0.38050310131155185, + 0.19443586243810795, + 0.5686976617292392 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 2, 1, 2], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 1, 3, 3], + "data": [ + 1.0390141010284424, + 1.0667248964309692, + 0.6772860884666443, + 0.8080586791038513, + 1.1259644031524658, + 0.960464596748352, + 0.3167303800582886, + 0.7729666829109192, + 0.9025675058364868 + ], + "type": "float32" + } + }, + { + "name": "depthwise conv2d float32 4D input and filter tensors options.groups= input_channels", + "inputs": { + "input": { + "shape": [1, 4, 2, 2], + "data": [ + 0.8444867694647586, + 0.9432409670525521, + 0.6556113430383732, + 0.6982811560969739, + 0.9994443556337815, + 0.23663609547122832, + 0.36740679911148977, + 0.26192464008498995, + 0.6254158900563778, + 0.8403864149984126, + 0.3783077112751454, + 0.4543924050667707, + 0.2532720958655783, + 0.5780375783781451, + 0.5414554298341647, + 0.3784630864473655 + ], + "type": "float32" + }, + "filter": { + "shape": [4, 1, 2, 2], + "data": [ + 0.2722161634913378, + 0.2812024814519549, + 0.8544839438625549, + 0.17969306710350352, + 0.7762278551409514, + 0.5140685342176547, + 0.6374202845672399, + 0.12801742574418573, + 0.8373775881302137, + 0.5726001728584655, + 0.0985520323467497, + 0.5929879082269991, + 0.5900803925387657, + 0.9690897431424881, + 0.2317559033646952, + 0.1480511343463049 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "groups": 4 + }, + "expected": { + "name": "output", + "shape": [1, 4, 1, 1], + "data": [ + 1.1808103322982788, + 1.165167212486267, + 1.311646819114685, + 0.8911385536193848 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nchw'", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nchw" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nhwc'", + "inputs": { + "input": { + "shape": [2, 3, 3, 1], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.8845428228378296, + 0.9626783132553101, + 0.8020333051681519, + 0.7413608431816101, + 0.9108520746231079, + 0.6277193427085876, + 0.2897796928882599, + 0.4832426905632019, + 0.4483422338962555, + 0.4053896367549896, + 0.4878997206687927, + 0.8711439371109009, + 0.6932874917984009, + 1.1787647008895874, + 0.9170808792114258, + 1.0369365215301514, + 0.8123774528503418, + 1.082636833190918, + 0.8282973766326904, + 0.816078782081604, + 1.2353861331939697, + 0.35335418581962585, + 0.6780439019203186, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.filterLayout='oihw'", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "oihw" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.filterLayout='hwio'", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 2, 1, 3], + "data": [ + 0.14543837927656278, + 0.6952692250382182, + 0.30721364807734, + 0.9671129790291346, + 0.5070913293589028, + 0.4324123448833208, + 0.10836050336762582, + 0.0813970738017622, + 0.9849002194630809, + 0.320230810822804, + 0.5303338853508432, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "hwio" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.filterLayout='ohwi'", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 2, 2, 1], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "ohwi" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.filterLayout='ihwo'", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 2, 3], + "data": [ + 0.14543837927656278, + 0.6952692250382182, + 0.30721364807734, + 0.9671129790291346, + 0.5070913293589028, + 0.4324123448833208, + 0.10836050336762582, + 0.0813970738017622, + 0.9849002194630809, + 0.320230810822804, + 0.5303338853508432, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "ihwo" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nhwc' and options.filterLayout='oihw'", + "inputs": { + "input": { + "shape": [2, 3, 3, 1], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc", + "filterLayout": "oihw" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.8845428228378296, + 0.9626783132553101, + 0.8020333051681519, + 0.7413608431816101, + 0.9108520746231079, + 0.6277193427085876, + 0.2897796928882599, + 0.4832426905632019, + 0.4483422338962555, + 0.4053896367549896, + 0.4878997206687927, + 0.8711439371109009, + 0.6932874917984009, + 1.1787647008895874, + 0.9170808792114258, + 1.0369365215301514, + 0.8123774528503418, + 1.082636833190918, + 0.8282973766326904, + 0.816078782081604, + 1.2353861331939697, + 0.35335418581962585, + 0.6780439019203186, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nhwc' and options.filterLayout='hwio'", + "inputs": { + "input": { + "shape": [2, 3, 3, 1], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 2, 1, 3], + "data": [ + 0.14543837927656278, + 0.6952692250382182, + 0.30721364807734, + 0.9671129790291346, + 0.5070913293589028, + 0.4324123448833208, + 0.10836050336762582, + 0.0813970738017622, + 0.9849002194630809, + 0.320230810822804, + 0.5303338853508432, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc", + "filterLayout": "hwio" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.8845428228378296, + 0.9626783132553101, + 0.8020333051681519, + 0.7413608431816101, + 0.9108520746231079, + 0.6277193427085876, + 0.2897796928882599, + 0.4832426905632019, + 0.4483422338962555, + 0.4053896367549896, + 0.4878997206687927, + 0.8711439371109009, + 0.6932874917984009, + 1.1787647008895874, + 0.9170808792114258, + 1.0369365215301514, + 0.8123774528503418, + 1.082636833190918, + 0.8282973766326904, + 0.816078782081604, + 1.2353861331939697, + 0.35335418581962585, + 0.6780439019203186, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nhwc' and options.filterLayout='ohwi'", + "inputs": { + "input": { + "shape": [2, 3, 3, 1], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 2, 2, 1], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc", + "filterLayout": "ohwi" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.8845428228378296, + 0.9626783132553101, + 0.8020333051681519, + 0.7413608431816101, + 0.9108520746231079, + 0.6277193427085876, + 0.2897796928882599, + 0.4832426905632019, + 0.4483422338962555, + 0.4053896367549896, + 0.4878997206687927, + 0.8711439371109009, + 0.6932874917984009, + 1.1787647008895874, + 0.9170808792114258, + 1.0369365215301514, + 0.8123774528503418, + 1.082636833190918, + 0.8282973766326904, + 0.816078782081604, + 1.2353861331939697, + 0.35335418581962585, + 0.6780439019203186, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.inputLayout='nhwc' and options.filterLayout='ihwo'", + "inputs": { + "input": { + "shape": [2, 3, 3, 1], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 2, 3], + "data": [ + 0.14543837927656278, + 0.6952692250382182, + 0.30721364807734, + 0.9671129790291346, + 0.5070913293589028, + 0.4324123448833208, + 0.10836050336762582, + 0.0813970738017622, + 0.9849002194630809, + 0.320230810822804, + 0.5303338853508432, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc", + "filterLayout": "ihwo" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.8845428228378296, + 0.9626783132553101, + 0.8020333051681519, + 0.7413608431816101, + 0.9108520746231079, + 0.6277193427085876, + 0.2897796928882599, + 0.4832426905632019, + 0.4483422338962555, + 0.4053896367549896, + 0.4878997206687927, + 0.8711439371109009, + 0.6932874917984009, + 1.1787647008895874, + 0.9170808792114258, + 1.0369365215301514, + 0.8123774528503418, + 1.082636833190918, + 0.8282973766326904, + 0.816078782081604, + 1.2353861331939697, + 0.35335418581962585, + 0.6780439019203186, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors 1D options.bias", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bias": { + "shape": [3], + "data": [ + 0.8135762411918082, + 0.8394582728923039, + 0.4944481217318142 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 1.698119044303894, + 1.5549371242523193, + 1.103355884552002, + 1.2189658880233765, + 1.8021366596221924, + 1.7503103017807007, + 1.3227009773254395, + 1.3273580074310303, + 1.2964813709259033, + 1.1221674680709839, + 0.9427903890609741, + 1.365592122077942, + 1.5068637132644653, + 1.8505127429962158, + 1.6418735980987549, + 1.1669304370880127, + 2.0182230472564697, + 1.6518357992172241, + 1.6555371284484863, + 1.5175021886825562, + 1.4115289449691772, + 1.577085018157959, + 1.7298341989517212, + 1.4754828214645386 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.activation=relu", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "activation": "relu" // relu operator + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.8845428228378296, + 0.7413608431816101, + 0.2897796928882599, + 0.4053896367549896, + 0.9626783132553101, + 0.9108520746231079, + 0.4832426905632019, + 0.4878997206687927, + 0.8020333051681519, + 0.6277193427085876, + 0.4483422338962555, + 0.8711439371109009, + 0.6932874917984009, + 1.0369365215301514, + 0.8282973766326904, + 0.35335418581962585, + 1.1787647008895874, + 0.8123774528503418, + 0.816078782081604, + 0.6780439019203186, + 0.9170808792114258, + 1.082636833190918, + 1.2353861331939697, + 0.9810346961021423 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors options.activation=sigmoid", + "inputs": { + "input": { + "shape": [2, 1, 3, 3], + "data": [ + 0.7529087201709872, + 0.7520291960017611, + 0.594952773514815, + 0.21631854011984264, + 0.07589348976741683, + 0.15106785419828572, + 0.12124850358598671, + 0.5364335407319905, + 0.5937089927693522, + 0.9910031422560608, + 0.36309423611370084, + 0.9289673923363004, + 0.22727376737331384, + 0.5414123970044269, + 0.0844534212564596, + 0.6765284772046276, + 0.619325655574763, + 0.39292160755260475 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 1, 2, 2], + "data": [ + 0.14543837927656278, + 0.9671129790291346, + 0.10836050336762582, + 0.320230810822804, + 0.6952692250382182, + 0.5070913293589028, + 0.0813970738017622, + 0.5303338853508432, + 0.30721364807734, + 0.4324123448833208, + 0.9849002194630809, + 0.4281076188358701 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "activation": "sigmoid" // sigmoid operator + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 0.7077627182006836, + 0.6772933602333069, + 0.5719422101974487, + 0.5999819040298462, + 0.7236577272415161, + 0.7131744623184204, + 0.618513286113739, + 0.6196115612983704, + 0.690409243106842, + 0.6519721746444702, + 0.6102449893951416, + 0.704983651638031, + 0.6666978597640991, + 0.7382584810256958, + 0.6959947943687439, + 0.5874307155609131, + 0.7647256255149841, + 0.6926159262657166, + 0.6934033632278442, + 0.6633020043373108, + 0.7144469618797302, + 0.7469926476478577, + 0.7747598886489868, + 0.7273134589195251 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors all options", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 0.099713865777741, + 0.5374298084250959, + 0.3057007632742843, + 0.7222362156944886, + 0.5066556292918762, + 0.32384305247826917, + 0.8721967991940403, + 0.2098985575512795, + 0.5052645707816252, + 0.026870572012360316, + 0.549711590167792, + 0.06430311230261965, + 0.15606686251064295, + 0.11970008688898925, + 0.036145712495725846, + 0.41425615451732734, + 0.2417246544172511, + 0.6771784996210519, + 0.20870001886065692, + 0.10979551271350108, + 0.74503571903267, + 0.744359267961296, + 0.7873413310077146, + 0.5887080289918305, + 0.11018028997622342, + 0.9045036346881179, + 0.11725221841523448, + 0.850866928863351, + 0.42449196218095864, + 0.025379145064212683, + 0.7473908464918035, + 0.46458599705779524, + 0.030408120922724935, + 0.4244018930520117, + 0.38475478117872863, + 0.7581132411894682, + 0.990195198482533, + 0.037168528384688315, + 0.01449632238827725, + 0.8263141930741622, + 0.21072064610591013, + 0.6569713718921535, + 0.25842808185295607, + 0.4802338559966235, + 0.9704218808133291, + 0.29682848294345554, + 0.7524365722467021, + 0.02963621027656349, + 0.09028015289625446, + 0.7781876138140071 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 2, 1, 2], + "data": [ + 0.6385681781775847, + 0.07764163946007407, + 0.12916297537217947, + 0.45633891510482494, + 0.40438535170611933, + 0.594362681497403, + 0.1424126456708108, + 0.9036699957427188 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 0, 0, 1], + "strides": [1, 1], + "autoPad": "explicit", + "dilations": [1, 1], + "groups": 2, + "inputLayout": "nchw", + "filterLayout": "hwio", + "bias": { + "shape": [2], + "data": [ + 0.5423753606058896, + 0.8406119024104419 + ], + "type": "float32" + }, + "activation": "relu" // relu operator + }, + "expected": { + "name": "output", + "shape": [1, 2, 5, 5], + "data": [ + 0.6592350006103516, + 0.8032397627830505, + 0.7688518762588501, + 0.9065912961959839, + 0.7472594976425171, + 0.9306347966194153, + 1.3076419830322266, + 0.987708330154419, + 1.277161955833435, + 0.8767756223678589, + 1.0932797193527222, + 1.1746727228164673, + 0.8218293786048889, + 0.9220445156097412, + 0.5741508603096008, + 1.103653073310852, + 0.7977840900421143, + 0.9610581398010254, + 0.7235122323036194, + 0.6098566055297852, + 1.2454158067703247, + 1.1973347663879395, + 1.4039851427078247, + 0.9435820579528809, + 0.6570426225662231, + 1.4841723442077637, + 1.6792051792144775, + 1.729936122894287, + 1.115848422050476, + 0.8556963205337524, + 1.828399419784546, + 1.5416107177734375, + 1.5019794702529907, + 1.4850915670394897, + 1.0712661743164062, + 2.4560532569885254, + 1.5126826763153076, + 1.0718353986740112, + 1.8044731616973877, + 1.3616151809692383, + 2.07026743888855, + 1.5584666728973389, + 1.4376858472824097, + 2.3811910152435303, + 1.4815508127212524, + 2.0131523609161377, + 1.4835525751113892, + 1.1790242195129395, + 2.0776233673095703, + 1.378482699394226 + ], + "type": "float32" + } + }, + { + "name": "conv2d float32 4D input and filter tensors, both negative input tensor and options.bias", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + -0.8073334836059594, + -0.8839999531200213, + -0.7700487271672907, + -0.5646049640597197, + -0.3971793875202543, + -0.1084135691143644, + -0.5519214808736546, + -0.3954172077064906, + -0.05758975763264007, + -0.5144240745380702, + -0.21321901474354354, + -0.9506090015630133, + -0.8043696918281786, + -0.8646378386343376, + -0.9607220763612241, + -0.3264438487690362, + -0.0688429735597631, + -0.32033992561547486, + -0.2692728077259734, + -0.34308877644524194, + -0.8989502140796819, + -0.9038569138324508, + -0.6369403164357454, + -0.20070796788073975, + -0.7870701966207543, + -0.3467883629993205, + -0.06004269369586446, + -0.1498520855746983, + -0.6482332485869089, + -0.8934088233365358, + -0.8149284803583503, + -0.642366834151139, + -0.03273624021014587, + -0.6608918929180299, + -0.5843491800022218, + -0.09921254485788045, + -0.1660252392520163, + -0.9508541527000836, + -0.30514628810841127, + -0.6210587190159238, + -0.5400903646960964, + -0.42009180747436625, + -0.1882453942541189, + -0.3588937522647535, + -0.7114293416682491, + -0.3751019899620214, + -0.7108227479593932, + -0.36050302242678467, + -0.5468712310796768, + -0.03226159510823612 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 2, 1, 2], + "data": [ + 0.6385681781775847, + 0.07764163946007407, + 0.12916297537217947, + 0.45633891510482494, + 0.40438535170611933, + 0.594362681497403, + 0.1424126456708108, + 0.9036699957427188 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 0, 0, 1], + "groups": 2, + "filterLayout": "hwio", + "bias": { + "shape": [2], + "data": [ + -0.37496936418502824, + -0.4363507146568044 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 5, 5], + "data": [ + -0.8273359537124634, + -0.8421106934547424, + -0.7667726874351501, + -0.6598507165908813, + -0.5355829000473022, + -1.1271283626556396, + -1.3184267282485962, + -1.1077264547348022, + -0.8833579421043396, + -0.8366210460662842, + -0.7370880246162415, + -1.2774468660354614, + -1.0833193063735962, + -0.9646547436714172, + -1.091966152191162, + -0.7757209539413452, + -1.1593523025512695, + -1.1681820154190063, + -1.2089394330978394, + -1.127195954322815, + -1.0845609903335571, + -0.9165211915969849, + -0.9004610180854797, + -0.78448486328125, + -0.9123346209526062, + -0.6967275738716125, + -0.6074546575546265, + -1.1112061738967896, + -1.6289831399917603, + -0.9673595428466797, + -1.5555264949798584, + -0.9207774996757507, + -1.3604848384857178, + -1.8152461051940918, + -0.8530317544937134, + -1.0017603635787964, + -1.4591015577316284, + -1.5813868045806885, + -1.4969244003295898, + -0.8508546352386475, + -1.2204514741897583, + -1.3029515743255615, + -1.0856342315673828, + -1.5996664762496948, + -0.9074177742004395, + -1.5352842807769775, + -1.303133249282837, + -1.3232042789459229, + -1.1430623531341553, + -0.5107623338699341 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/conv_transpose2d.json b/testing/web-platform/tests/webnn/resources/test_data/conv_transpose2d.json new file mode 100644 index 0000000000..c7026f91ee --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/conv_transpose2d.json @@ -0,0 +1,2087 @@ +{ + "tests": [ + { + "name": "convTranspose2d float32 4D input and filter(non-constant) tensors default options", + "inputs": { + "input": { + "shape": [1, 1, 2, 2], + "data": [ + 0.5872158177067033, + 0.6077792328258038, + 0.01728916618181975, + 0.26146076483771563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 2, 2], + "data": [ + 0.32927132527587477, + 0.5866857173772775, + 0.29701370673751004, + 0.0033378428248385106 + ], + "type": "float32" + } + }, + "expected": { + "shape": [1, 1, 3, 3], + "data": [ + 0.1933533400297165, + 0.5446354150772095, + 0.3565753698348999, + 0.18010397255420685, + 0.2787136137485504, + 0.15542395412921906, + 0.0051351189613342285, + 0.07771513611078262, + 0.0008727149106562138 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors default options", + "inputs": { + "input": { + "shape": [1, 1, 2, 2], + "data": [ + 0.5872158177067033, + 0.6077792328258038, + 0.01728916618181975, + 0.26146076483771563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 2, 2], + "data": [ + 0.32927132527587477, + 0.5866857173772775, + 0.29701370673751004, + 0.0033378428248385106 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [1, 1, 3, 3], + "data": [ + 0.1933533400297165, + 0.5446354150772095, + 0.3565753698348999, + 0.18010397255420685, + 0.2787136137485504, + 0.15542395412921906, + 0.0051351189613342285, + 0.07771513611078262, + 0.0008727149106562138 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.padding", + "inputs": { + "input": { + "shape": [1, 1, 2, 2], + "data": [ + 0.5872158177067033, + 0.6077792328258038, + 0.01728916618181975, + 0.26146076483771563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 2, 2], + "data": [ + 0.32927132527587477, + 0.5866857173772775, + 0.29701370673751004, + 0.0033378428248385106 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1] + }, + "expected": { + "shape": [1, 1, 1, 1], + "data": [ + 0.2787136137485504 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.strides", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [3, 2] + }, + "expected": { + "shape": [1, 2, 9, 7], + "data": [ + 0.04828956723213196, + 0.03513447195291519, + 0.6485382318496704, + 0.4458966553211212, + 1.015426516532898, + 0.4092629551887512, + 0.4157154858112335, + 0.0469902828335762, + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.6478374600410461, + 0.018416915088891983, + 0.04900681599974632, + 0.27412328124046326, + 0.6219525337219238, + 0.7271442413330078, + 0.5708546042442322, + 0.4705001711845398, + 0.3327140808105469, + 0.24207575619220734, + 0.5793426632881165, + 0.24261142313480377, + 1.0615012645721436, + 0.593023955821991, + 0.6023737192153931, + 0.32376202940940857, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.9387195110321045, + 0.12689214944839478, + 0.3376559019088745, + 0.40547001361846924, + 0.3384030759334564, + 0.5897663235664368, + 0.8271709680557251, + 0.6817569732666016, + 0.08246752619743347, + 0.06000163406133652, + 0.8564596176147461, + 0.5787978172302246, + 1.1360399723052979, + 0.39879822731018066, + 0.4050857424736023, + 0.0802486464381218, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.6312723755836487, + 0.03145187348127365, + 0.08369242399930954, + 0.37237587571144104, + 0.8073278069496155, + 0.8744456768035889, + 0.556257963180542, + 0.45846959948539734, + 0.05494653806090355, + 0.0034586030524224043, + 0.7153855562210083, + 0.04389362782239914, + 0.869132936000824, + 0.04028744250535965, + 0.21026825904846191, + 0.04203145205974579, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.0901883915066719, + 0.015911730006337166, + 0.023744819685816765, + 0.21005792915821075, + 0.30134889483451843, + 0.2883978486061096, + 0.27659088373184204, + 0.09458412230014801, + 0.3785804808139801, + 0.02382970042526722, + 0.5037901997566223, + 0.0238824300467968, + 1.0520728826522827, + 0.05837669596076012, + 0.3046796917915344, + 0.2895958125591278, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.13068340718746185, + 0.1096314787864685, + 0.16360129415988922, + 0.16581982374191284, + 0.16396330296993256, + 0.3246387541294098, + 0.400781512260437, + 0.13705284893512726, + 0.09383610635995865, + 0.00590650225058198, + 0.9360047578811646, + 0.05697628855705261, + 0.9210482239723206, + 0.03925730288028717, + 0.20489174127578735, + 0.07178010046482086, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704, + 0.08788229525089264, + 0.027173593640327454, + 0.04055071249604225, + 0.27599334716796875, + 0.3911670744419098, + 0.3143731355667114, + 0.26951852440834045, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.dilations", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.3194596882329144, + 0.9762163819788108, + 0.41314086405782646, + 0.4798294207950651, + 0.7674162198689658, + 0.9083173676123812, + 0.620514237394759, + 0.6580719790256742, + 0.6553052148945859 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 2, 2], + "data": [ + 0.6835425651112257, + 0.9641214608820772, + 0.8272836859778003, + 0.5771222965089409 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "dilations": [2, 2] + }, + "expected": { + "shape": [1, 1, 5, 5], + "data": [ + 0.21836428344249725, + 0.6672854423522949, + 0.590397298336029, + 0.9411911368370056, + 0.39831796288490295, + 0.3279838263988495, + 0.5245616436004639, + 1.0834873914718628, + 0.7398824691772461, + 0.8757283091545105, + 0.6884316205978394, + 1.2574280500411987, + 1.5723320245742798, + 1.1978574991226196, + 0.8702266216278076, + 0.39695504307746887, + 0.6348709464073181, + 1.0283564329147339, + 0.44289299845695496, + 0.5242102146148682, + 0.5133413076400757, + 0.5444121956825256, + 0.9002358913421631, + 0.37978801131248474, + 0.3781912326812744 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.outputPadding", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [3, 2], + "outputPadding": [1, 1] + }, + "expected": { + "shape": [1, 2, 10, 8], + "data": [ + 0.04828956723213196, + 0.03513447195291519, + 0.6485382318496704, + 0.4458966553211212, + 1.015426516532898, + 0.4092629551887512, + 0.4157154858112335, + 0, + 0.0469902828335762, + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.6478374600410461, + 0, + 0.018416915088891983, + 0.04900681599974632, + 0.27412328124046326, + 0.6219525337219238, + 0.7271442413330078, + 0.5708546042442322, + 0.4705001711845398, + 0, + 0.3327140808105469, + 0.24207575619220734, + 0.5793426632881165, + 0.24261142313480377, + 1.0615012645721436, + 0.593023955821991, + 0.6023737192153931, + 0, + 0.32376202940940857, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.9387195110321045, + 0, + 0.12689214944839478, + 0.3376559019088745, + 0.40547001361846924, + 0.3384030759334564, + 0.5897663235664368, + 0.8271709680557251, + 0.6817569732666016, + 0, + 0.08246752619743347, + 0.06000163406133652, + 0.8564596176147461, + 0.5787978172302246, + 1.1360399723052979, + 0.39879822731018066, + 0.4050857424736023, + 0, + 0.0802486464381218, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.6312723755836487, + 0, + 0.03145187348127365, + 0.08369242399930954, + 0.37237587571144104, + 0.8073278069496155, + 0.8744456768035889, + 0.556257963180542, + 0.45846959948539734, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.05494653806090355, + 0.0034586030524224043, + 0.7153855562210083, + 0.04389362782239914, + 0.869132936000824, + 0.04028744250535965, + 0.21026825904846191, + 0, + 0.04203145205974579, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.0901883915066719, + 0, + 0.015911730006337166, + 0.023744819685816765, + 0.21005792915821075, + 0.30134889483451843, + 0.2883978486061096, + 0.27659088373184204, + 0.09458412230014801, + 0, + 0.3785804808139801, + 0.02382970042526722, + 0.5037901997566223, + 0.0238824300467968, + 1.0520728826522827, + 0.05837669596076012, + 0.3046796917915344, + 0, + 0.2895958125591278, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.13068340718746185, + 0, + 0.1096314787864685, + 0.16360129415988922, + 0.16581982374191284, + 0.16396330296993256, + 0.3246387541294098, + 0.400781512260437, + 0.13705284893512726, + 0, + 0.09383610635995865, + 0.00590650225058198, + 0.9360047578811646, + 0.05697628855705261, + 0.9210482239723206, + 0.03925730288028717, + 0.20489174127578735, + 0, + 0.07178010046482086, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704, + 0.08788229525089264, + 0, + 0.027173593640327454, + 0.04055071249604225, + 0.27599334716796875, + 0.3911670744419098, + 0.3143731355667114, + 0.26951852440834045, + 0.09216563403606415, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.outputSizes", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [3, 2], + "outputSizes": [10, 8] + }, + "expected": { + "shape": [1, 2, 10, 8], + "data": [ + 0.04828956723213196, + 0.03513447195291519, + 0.6485382318496704, + 0.4458966553211212, + 1.015426516532898, + 0.4092629551887512, + 0.4157154858112335, + 0, + 0.0469902828335762, + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.6478374600410461, + 0, + 0.018416915088891983, + 0.04900681599974632, + 0.27412328124046326, + 0.6219525337219238, + 0.7271442413330078, + 0.5708546042442322, + 0.4705001711845398, + 0, + 0.3327140808105469, + 0.24207575619220734, + 0.5793426632881165, + 0.24261142313480377, + 1.0615012645721436, + 0.593023955821991, + 0.6023737192153931, + 0, + 0.32376202940940857, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.9387195110321045, + 0, + 0.12689214944839478, + 0.3376559019088745, + 0.40547001361846924, + 0.3384030759334564, + 0.5897663235664368, + 0.8271709680557251, + 0.6817569732666016, + 0, + 0.08246752619743347, + 0.06000163406133652, + 0.8564596176147461, + 0.5787978172302246, + 1.1360399723052979, + 0.39879822731018066, + 0.4050857424736023, + 0, + 0.0802486464381218, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.6312723755836487, + 0, + 0.03145187348127365, + 0.08369242399930954, + 0.37237587571144104, + 0.8073278069496155, + 0.8744456768035889, + 0.556257963180542, + 0.45846959948539734, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0.05494653806090355, + 0.0034586030524224043, + 0.7153855562210083, + 0.04389362782239914, + 0.869132936000824, + 0.04028744250535965, + 0.21026825904846191, + 0, + 0.04203145205974579, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.0901883915066719, + 0, + 0.015911730006337166, + 0.023744819685816765, + 0.21005792915821075, + 0.30134889483451843, + 0.2883978486061096, + 0.27659088373184204, + 0.09458412230014801, + 0, + 0.3785804808139801, + 0.02382970042526722, + 0.5037901997566223, + 0.0238824300467968, + 1.0520728826522827, + 0.05837669596076012, + 0.3046796917915344, + 0, + 0.2895958125591278, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.13068340718746185, + 0, + 0.1096314787864685, + 0.16360129415988922, + 0.16581982374191284, + 0.16396330296993256, + 0.3246387541294098, + 0.400781512260437, + 0.13705284893512726, + 0, + 0.09383610635995865, + 0.00590650225058198, + 0.9360047578811646, + 0.05697628855705261, + 0.9210482239723206, + 0.03925730288028717, + 0.20489174127578735, + 0, + 0.07178010046482086, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704, + 0.08788229525089264, + 0, + 0.027173593640327454, + 0.04055071249604225, + 0.27599334716796875, + 0.3911670744419098, + 0.3143731355667114, + 0.26951852440834045, + 0.09216563403606415, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.autoPad=explicit options.padding", + "inputs": { + "input": { + "shape": [1, 1, 2, 2], + "data": [ + 0.5872158177067033, + 0.6077792328258038, + 0.01728916618181975, + 0.26146076483771563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 2, 2], + "data": [ + 0.32927132527587477, + 0.5866857173772775, + 0.29701370673751004, + 0.0033378428248385106 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1], + "autoPad": "explicit" + }, + "expected": { + "shape": [1, 1, 1, 1], + "data": [ + 0.2787136137485504 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.autoPad=same-upper", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "shape": [1, 2, 6, 6], + "data": [ + 0.04828956723213196, + 0.03513447195291519, + 0.6485382318496704, + 0.4458966553211212, + 1.015426516532898, + 0.4092629551887512, + 0.0469902828335762, + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.35113099217414856, + 0.29108259081840515, + 0.8534659743309021, + 0.8645639419555664, + 1.7886453866958618, + 1.1638785600662231, + 0.32376202940940857, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.20935966074466705, + 0.3976575434207916, + 1.2619296312332153, + 0.9172008633613586, + 1.7258063554763794, + 1.2259691953659058, + 0.0802486464381218, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.05494653806090355, + 0.0034586030524224043, + 0.7153855562210083, + 0.04389362782239914, + 0.869132936000824, + 0.04028744250535965, + 0.04203145205974579, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.3944922089576721, + 0.047574520111083984, + 0.7138481140136719, + 0.3252313435077667, + 1.340470790863037, + 0.33496758341789246, + 0.2895958125591278, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.20346759259700775, + 0.16950778663158417, + 1.1018246412277222, + 0.22093959152698517, + 1.2456870079040527, + 0.440038800239563, + 0.07178010046482086, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.autoPad=same-upper ignored options.padding", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "shape": [1, 2, 6, 6], + "data": [ + 0.04828956723213196, + 0.03513447195291519, + 0.6485382318496704, + 0.4458966553211212, + 1.015426516532898, + 0.4092629551887512, + 0.0469902828335762, + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.35113099217414856, + 0.29108259081840515, + 0.8534659743309021, + 0.8645639419555664, + 1.7886453866958618, + 1.1638785600662231, + 0.32376202940940857, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.20935966074466705, + 0.3976575434207916, + 1.2619296312332153, + 0.9172008633613586, + 1.7258063554763794, + 1.2259691953659058, + 0.0802486464381218, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.05494653806090355, + 0.0034586030524224043, + 0.7153855562210083, + 0.04389362782239914, + 0.869132936000824, + 0.04028744250535965, + 0.04203145205974579, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.3944922089576721, + 0.047574520111083984, + 0.7138481140136719, + 0.3252313435077667, + 1.340470790863037, + 0.33496758341789246, + 0.2895958125591278, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.20346759259700775, + 0.16950778663158417, + 1.1018246412277222, + 0.22093959152698517, + 1.2456870079040527, + 0.440038800239563, + 0.07178010046482086, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.autoPad=same-lower", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "shape": [1, 2, 6, 6], + "data": [ + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.6478374600410461, + 0.29108259081840515, + 0.8534659743309021, + 0.8645639419555664, + 1.7886453866958618, + 1.1638785600662231, + 1.072873830795288, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.9387195110321045, + 0.3976575434207916, + 1.2619296312332153, + 0.9172008633613586, + 1.7258063554763794, + 1.2259691953659058, + 1.0868427753448486, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.6312723755836487, + 0.08369242399930954, + 0.37237587571144104, + 0.8073278069496155, + 0.8744456768035889, + 0.556257963180542, + 0.45846959948539734, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.0901883915066719, + 0.047574520111083984, + 0.7138481140136719, + 0.3252313435077667, + 1.340470790863037, + 0.33496758341789246, + 0.39926382899284363, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.13068340718746185, + 0.16950778663158417, + 1.1018246412277222, + 0.22093959152698517, + 1.2456870079040527, + 0.440038800239563, + 0.3419445753097534, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704, + 0.08788229525089264, + 0.04055071249604225, + 0.27599334716796875, + 0.3911670744419098, + 0.3143731355667114, + 0.26951852440834045, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.autoPad=same-lower ignored options.padding", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "padding": [1, 1, 1, 1], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "shape": [1, 2, 6, 6], + "data": [ + 0.0066622416488826275, + 0.6519761085510254, + 0.08455146849155426, + 1.2531912326812744, + 0.07760494202375412, + 0.6478374600410461, + 0.29108259081840515, + 0.8534659743309021, + 0.8645639419555664, + 1.7886453866958618, + 1.1638785600662231, + 1.072873830795288, + 0.04590269923210144, + 0.7076690793037415, + 0.0460042729973793, + 1.177173137664795, + 0.11244992911815643, + 0.9387195110321045, + 0.3976575434207916, + 1.2619296312332153, + 0.9172008633613586, + 1.7258063554763794, + 1.2259691953659058, + 1.0868427753448486, + 0.011377583257853985, + 0.8690866827964783, + 0.1097523421049118, + 1.4495694637298584, + 0.0756206065416336, + 0.6312723755836487, + 0.08369242399930954, + 0.37237587571144104, + 0.8073278069496155, + 0.8744456768035889, + 0.556257963180542, + 0.45846959948539734, + 0.02203426882624626, + 0.5411697030067444, + 0.2796400785446167, + 0.5878635048866272, + 0.25666558742523193, + 0.0901883915066719, + 0.047574520111083984, + 0.7138481140136719, + 0.3252313435077667, + 1.340470790863037, + 0.33496758341789246, + 0.39926382899284363, + 0.15181563794612885, + 0.3435823321342468, + 0.15215156972408295, + 0.7628997564315796, + 0.37190964818000793, + 0.13068340718746185, + 0.16950778663158417, + 1.1018246412277222, + 0.22093959152698517, + 1.2456870079040527, + 0.440038800239563, + 0.3419445753097534, + 0.03762948885560036, + 0.7056396007537842, + 0.36298784613609314, + 0.6046316623687744, + 0.2501027286052704, + 0.08788229525089264, + 0.04055071249604225, + 0.27599334716796875, + 0.3911670744419098, + 0.3143731355667114, + 0.26951852440834045, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.inputLayout=nchw", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nchw" + }, + "expected": { + "shape": [1, 2, 5, 5], + "data": [ + 0.04828956723213196, + 0.6479843258857727, + 1.0440847873687744, + 0.8621897101402283, + 0.4157154858112335, + 0.3797043561935425, + 1.1785486936569214, + 1.9911006689071655, + 1.6228916645050049, + 1.2502111196517944, + 0.4246464669704437, + 1.5086332559585571, + 3.287064790725708, + 2.5666797161102295, + 1.8143054246902466, + 0.20714078843593597, + 1.2503143548965454, + 1.6656538248062134, + 2.097904920578003, + 1.313029408454895, + 0.03145187348127365, + 0.38708874583244324, + 1.0853508710861206, + 1.2216601371765137, + 0.45846959948539734, + 0.05494653806090355, + 0.7007930278778076, + 0.7019880414009094, + 0.26937708258628845, + 0.21026825904846191, + 0.4206119179725647, + 0.9587093591690063, + 1.8526650667190552, + 0.5379507541656494, + 0.39486807584762573, + 0.3993436396121979, + 1.5788191556930542, + 2.121230363845825, + 1.141642689704895, + 0.4301592707633972, + 0.18141157925128937, + 1.0035220384597778, + 1.3417718410491943, + 0.8345021605491638, + 0.2249351441860199, + 0.027173593640327454, + 0.3026771545410156, + 0.5856420397758484, + 0.40328359603881836, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.inputLayout=nhwc", + "inputs": { + "input": { + "shape": [1, 3, 3, 1], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "inputLayout": "nhwc" + }, + "expected": { + "shape": [1, 5, 5, 2], + "data": [ + 0.04828956723213196, + 0.05494653806090355, + 0.6479843258857727, + 0.7007930278778076, + 1.0440847873687744, + 0.7019880414009094, + 0.8621897101402283, + 0.26937708258628845, + 0.4157154858112335, + 0.21026825904846191, + 0.3797043561935425, + 0.4206119179725647, + 1.1785486936569214, + 0.9587093591690063, + 1.9911006689071655, + 1.8526650667190552, + 1.6228916645050049, + 0.5379507541656494, + 1.2502111196517944, + 0.39486807584762573, + 0.4246464669704437, + 0.3993436396121979, + 1.5086332559585571, + 1.5788191556930542, + 3.287064790725708, + 2.121230363845825, + 2.5666797161102295, + 1.141642689704895, + 1.8143054246902466, + 0.4301592707633972, + 0.20714078843593597, + 0.18141157925128937, + 1.2503143548965454, + 1.0035220384597778, + 1.6656538248062134, + 1.3417718410491943, + 2.097904920578003, + 0.8345021605491638, + 1.313029408454895, + 0.2249351441860199, + 0.03145187348127365, + 0.027173593640327454, + 0.38708874583244324, + 0.3026771545410156, + 1.0853508710861206, + 0.5856420397758484, + 1.2216601371765137, + 0.40328359603881836, + 0.45846959948539734, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.filterLayout=iohw", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 2, 3, 3], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "iohw" + }, + "expected": { + "shape": [1, 2, 5, 5], + "data": [ + 0.04828956723213196, + 0.6479843258857727, + 1.0440847873687744, + 0.8621897101402283, + 0.4157154858112335, + 0.3797043561935425, + 1.1785486936569214, + 1.9911006689071655, + 1.6228916645050049, + 1.2502111196517944, + 0.4246464669704437, + 1.5086332559585571, + 3.287064790725708, + 2.5666797161102295, + 1.8143054246902466, + 0.20714078843593597, + 1.2503143548965454, + 1.6656538248062134, + 2.097904920578003, + 1.313029408454895, + 0.03145187348127365, + 0.38708874583244324, + 1.0853508710861206, + 1.2216601371765137, + 0.45846959948539734, + 0.05494653806090355, + 0.7007930278778076, + 0.7019880414009094, + 0.26937708258628845, + 0.21026825904846191, + 0.4206119179725647, + 0.9587093591690063, + 1.8526650667190552, + 0.5379507541656494, + 0.39486807584762573, + 0.3993436396121979, + 1.5788191556930542, + 2.121230363845825, + 1.141642689704895, + 0.4301592707633972, + 0.18141157925128937, + 1.0035220384597778, + 1.3417718410491943, + 0.8345021605491638, + 0.2249351441860199, + 0.027173593640327454, + 0.3026771545410156, + 0.5856420397758484, + 0.40328359603881836, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.filterLayout=hwoi", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [3, 3, 2, 1], + "data": [ + 0.861442276299335, + 0.9801966684571415, + 0.6267672619279181, + 0.06169835353027997, + 0.6366489967621862, + 0.3220160786486479, + 0.8382642064548715, + 0.7498031716529909, + 0.11884837321114183, + 0.39307147694602995, + 0.9921330460504791, + 0.1381193362338462, + 0.3285411258903119, + 0.283850915413119, + 0.8742373539889388, + 0.4235861336377129, + 0.7205492498486465, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "hwoi" + }, + "expected": { + "shape": [1, 2, 5, 5], + "data": [ + 0.04828956723213196, + 0.6479843258857727, + 1.0440847873687744, + 0.8621897101402283, + 0.4157154858112335, + 0.3797043561935425, + 1.1785486936569214, + 1.9911006689071655, + 1.6228916645050049, + 1.2502111196517944, + 0.4246464669704437, + 1.5086332559585571, + 3.287064790725708, + 2.5666797161102295, + 1.8143054246902466, + 0.20714078843593597, + 1.2503143548965454, + 1.6656538248062134, + 2.097904920578003, + 1.313029408454895, + 0.03145187348127365, + 0.38708874583244324, + 1.0853508710861206, + 1.2216601371765137, + 0.45846959948539734, + 0.05494653806090355, + 0.7007930278778076, + 0.7019880414009094, + 0.26937708258628845, + 0.21026825904846191, + 0.4206119179725647, + 0.9587093591690063, + 1.8526650667190552, + 0.5379507541656494, + 0.39486807584762573, + 0.3993436396121979, + 1.5788191556930542, + 2.121230363845825, + 1.141642689704895, + 0.4301592707633972, + 0.18141157925128937, + 1.0035220384597778, + 1.3417718410491943, + 0.8345021605491638, + 0.2249351441860199, + 0.027173593640327454, + 0.3026771545410156, + 0.5856420397758484, + 0.40328359603881836, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.filterLayout=ohwi", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.05605664967552748, + 0.7114230061939892, + 0.6529743817798401, + 0.3862290922141163, + 0.38708372734474095, + 0.9461629334832131, + 0.0957319185290193, + 0.9234652551205444, + 0.6362779541136516 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 3, 3, 1], + "data": [ + 0.861442276299335, + 0.6267672619279181, + 0.6366489967621862, + 0.8382642064548715, + 0.11884837321114183, + 0.9921330460504791, + 0.3285411258903119, + 0.8742373539889388, + 0.7205492498486465, + 0.9801966684571415, + 0.06169835353027997, + 0.3220160786486479, + 0.7498031716529909, + 0.39307147694602995, + 0.1381193362338462, + 0.283850915413119, + 0.4235861336377129, + 0.14485120857485168 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "filterLayout": "ohwi" + }, + "expected": { + "shape": [1, 2, 5, 5], + "data": [ + 0.04828956723213196, + 0.6479843258857727, + 1.0440847873687744, + 0.8621897101402283, + 0.4157154858112335, + 0.3797043561935425, + 1.1785486936569214, + 1.9911006689071655, + 1.6228916645050049, + 1.2502111196517944, + 0.4246464669704437, + 1.5086332559585571, + 3.287064790725708, + 2.5666797161102295, + 1.8143054246902466, + 0.20714078843593597, + 1.2503143548965454, + 1.6656538248062134, + 2.097904920578003, + 1.313029408454895, + 0.03145187348127365, + 0.38708874583244324, + 1.0853508710861206, + 1.2216601371765137, + 0.45846959948539734, + 0.05494653806090355, + 0.7007930278778076, + 0.7019880414009094, + 0.26937708258628845, + 0.21026825904846191, + 0.4206119179725647, + 0.9587093591690063, + 1.8526650667190552, + 0.5379507541656494, + 0.39486807584762573, + 0.3993436396121979, + 1.5788191556930542, + 2.121230363845825, + 1.141642689704895, + 0.4301592707633972, + 0.18141157925128937, + 1.0035220384597778, + 1.3417718410491943, + 0.8345021605491638, + 0.2249351441860199, + 0.027173593640327454, + 0.3026771545410156, + 0.5856420397758484, + 0.40328359603881836, + 0.09216563403606415 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.bias", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.11095754619056808, + 0.8681362056660518, + 0.7342095941654914, + 0.43077004493855875, + 0.5981626867187566, + 0.1232164990736122, + 0.16109748910776922, + 0.08840264384189989, + 0.2910097194319563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.6161394585554596, + 0.262246148184051, + 0.7951397994036709, + 0.87305609470791, + 0.8309101763741125, + 0.8549605393357718, + 0.5552039743814143, + 0.8400921243865438, + 0.8530843869413023 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bias": { + "shape": [1], + "data": [ + 0.4516736859570645 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [1, 1, 5, 5], + "data": [ + 0.5200390219688416, + 1.01566481590271, + 1.2199413776397705, + 1.3345069885253906, + 1.0354729890823364, + 0.8139602541923523, + 1.7833205461502075, + 2.484194278717041, + 2.311894178390503, + 1.1773682832717896, + 0.9886226654052734, + 2.0037572383880615, + 2.9867470264434814, + 2.5694668292999268, + 1.41475510597229, + 0.8314860463142395, + 1.3567005395889282, + 1.8553334474563599, + 1.3828538656234741, + 0.8055896162986755, + 0.5411156415939331, + 0.6360918879508972, + 0.8249395489692688, + 0.7715635895729065, + 0.6999295353889465 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors, both negative input tensor and options.bias", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + -0.1088905666228781, + -0.2980190376593821, + -0.39077856560563506, + -0.5624061411820445, + -0.732209362325523, + -0.8421320780728827, + -0.3059865397862138, + -0.9766599001467926, + -0.014158561610918996 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.6161394585554596, + 0.262246148184051, + 0.7951397994036709, + 0.87305609470791, + 0.8309101763741125, + 0.8549605393357718, + 0.5552039743814143, + 0.8400921243865438, + 0.8530843869413023 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bias": { + "shape": [1], + "data": [ + -0.8457866242505638 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [1, 1, 5, 5], + "data": [ + -0.9128783941268921, + -1.0579640865325928, + -1.2512983083724976, + -1.1852335929870605, + -1.1565102338790894, + -1.2873748540878296, + -1.7950842380523682, + -2.6857638359069824, + -2.2283377647399902, + -1.8494995832443237, + -1.5857856273651123, + -2.8912975788116455, + -3.738619565963745, + -3.5343525409698486, + -1.910401463508606, + -1.425180196762085, + -2.8317112922668457, + -3.49372935295105, + -3.0246617794036865, + -1.5763013362884521, + -1.0156716108322144, + -1.645089030265808, + -1.935164213180542, + -1.6908544301986694, + -0.8578650951385498 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.activation=relu", + "inputs": { + "input": { + "shape": [1, 1, 3, 3], + "data": [ + 0.11095754619056808, + 0.8681362056660518, + 0.7342095941654914, + 0.43077004493855875, + 0.5981626867187566, + 0.1232164990736122, + 0.16109748910776922, + 0.08840264384189989, + 0.2910097194319563 + ], + "type": "float32" + }, + "filter": { + "shape": [1, 1, 3, 3], + "data": [ + 0.6161394585554596, + 0.262246148184051, + 0.7951397994036709, + 0.87305609470791, + 0.8309101763741125, + 0.8549605393357718, + 0.5552039743814143, + 0.8400921243865438, + 0.8530843869413023 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "activation": "relu" // relu operator + }, + "expected": { + "shape": [1, 1, 5, 5], + "data": [ + 0.06836532801389694, + 0.5639911890029907, + 0.7682676911354065, + 0.8828333020210266, + 0.5837992429733276, + 0.36228659749031067, + 1.3316468000411987, + 2.0325205326080322, + 1.8602205514907837, + 0.7256945967674255, + 0.5369489789009094, + 1.5520836114883423, + 2.5350732803344727, + 2.117793083190918, + 0.963081419467926, + 0.3798123896121979, + 0.9050268530845642, + 1.403659701347351, + 0.9311801791191101, + 0.35391589999198914, + 0.08944196254014969, + 0.1844182312488556, + 0.3732658624649048, + 0.3198899030685425, + 0.24825584888458252 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/cos.json b/testing/web-platform/tests/webnn/resources/test_data/cos.json new file mode 100644 index 0000000000..4d99232550 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/cos.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "cos float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 85.56368722678593, + -45.09983640817779, + -94.6775036804249, + 83.49029219662862, + -31.367904335227692, + 70.1804254973957, + -90.36229826898601, + -83.00758001757269, + 61.51649571682452, + -32.51877900985289, + -48.376587517032775, + -58.02735967650854, + 89.79197789644661, + -84.53326629430444, + -58.23252607768894, + -76.14168597373077, + -59.05887786348942, + 77.38546821194151, + -98.67289449592316, + -63.611559926077675, + 26.857246203003186, + 83.70417131490925, + 76.56606838780263, + -47.83436545380422 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.7380040884017944, + 0.43789437413215637, + 0.9090799689292908, + -0.23584702610969543, + 0.9988471865653992, + 0.48416373133659363, + -0.7358400821685791, + 0.24218930304050446, + 0.25266921520233154, + 0.4510514736175537, + -0.31276169419288635, + 0.09197491407394409, + -0.2537800967693329, + -0.9583188891410828, + -0.11282006651163101, + 0.736129879951477, + -0.80721116065979, + -0.4045141637325287, + -0.283336341381073, + 0.7111190557479858, + -0.1531042903661728, + -0.43673399090766907, + 0.39213326573371887, + -0.7580515146255493 + ], + "type": "float32" + } + }, + { + "name": "cos float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 85.56368722678593, + -45.09983640817779, + -94.6775036804249, + 83.49029219662862, + -31.367904335227692, + 70.1804254973957, + -90.36229826898601, + -83.00758001757269, + 61.51649571682452, + -32.51877900985289, + -48.376587517032775, + -58.02735967650854, + 89.79197789644661, + -84.53326629430444, + -58.23252607768894, + -76.14168597373077, + -59.05887786348942, + 77.38546821194151, + -98.67289449592316, + -63.611559926077675, + 26.857246203003186, + 83.70417131490925, + 76.56606838780263, + -47.83436545380422 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.7380040884017944, + 0.43789437413215637, + 0.9090799689292908, + -0.23584702610969543, + 0.9988471865653992, + 0.48416373133659363, + -0.7358400821685791, + 0.24218930304050446, + 0.25266921520233154, + 0.4510514736175537, + -0.31276169419288635, + 0.09197491407394409, + -0.2537800967693329, + -0.9583188891410828, + -0.11282006651163101, + 0.736129879951477, + -0.80721116065979, + -0.4045141637325287, + -0.283336341381073, + 0.7111190557479858, + -0.1531042903661728, + -0.43673399090766907, + 0.39213326573371887, + -0.7580515146255493 + ], + "type": "float32" + } + }, + { + "name": "cos float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 85.56368722678593, + -45.09983640817779, + -94.6775036804249, + 83.49029219662862, + -31.367904335227692, + 70.1804254973957, + -90.36229826898601, + -83.00758001757269, + 61.51649571682452, + -32.51877900985289, + -48.376587517032775, + -58.02735967650854, + 89.79197789644661, + -84.53326629430444, + -58.23252607768894, + -76.14168597373077, + -59.05887786348942, + 77.38546821194151, + -98.67289449592316, + -63.611559926077675, + 26.857246203003186, + 83.70417131490925, + 76.56606838780263, + -47.83436545380422 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.7380040884017944, + 0.43789437413215637, + 0.9090799689292908, + -0.23584702610969543, + 0.9988471865653992, + 0.48416373133659363, + -0.7358400821685791, + 0.24218930304050446, + 0.25266921520233154, + 0.4510514736175537, + -0.31276169419288635, + 0.09197491407394409, + -0.2537800967693329, + -0.9583188891410828, + -0.11282006651163101, + 0.736129879951477, + -0.80721116065979, + -0.4045141637325287, + -0.283336341381073, + 0.7111190557479858, + -0.1531042903661728, + -0.43673399090766907, + 0.39213326573371887, + -0.7580515146255493 + ], + "type": "float32" + } + }, + { + "name": "cos float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 85.56368722678593, + -45.09983640817779, + -94.6775036804249, + 83.49029219662862, + -31.367904335227692, + 70.1804254973957, + -90.36229826898601, + -83.00758001757269, + 61.51649571682452, + -32.51877900985289, + -48.376587517032775, + -58.02735967650854, + 89.79197789644661, + -84.53326629430444, + -58.23252607768894, + -76.14168597373077, + -59.05887786348942, + 77.38546821194151, + -98.67289449592316, + -63.611559926077675, + 26.857246203003186, + 83.70417131490925, + 76.56606838780263, + -47.83436545380422 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -0.7380040884017944, + 0.43789437413215637, + 0.9090799689292908, + -0.23584702610969543, + 0.9988471865653992, + 0.48416373133659363, + -0.7358400821685791, + 0.24218930304050446, + 0.25266921520233154, + 0.4510514736175537, + -0.31276169419288635, + 0.09197491407394409, + -0.2537800967693329, + -0.9583188891410828, + -0.11282006651163101, + 0.736129879951477, + -0.80721116065979, + -0.4045141637325287, + -0.283336341381073, + 0.7111190557479858, + -0.1531042903661728, + -0.43673399090766907, + 0.39213326573371887, + -0.7580515146255493 + ], + "type": "float32" + } + }, + { + "name": "cos float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 85.56368722678593, + -45.09983640817779, + -94.6775036804249, + 83.49029219662862, + -31.367904335227692, + 70.1804254973957, + -90.36229826898601, + -83.00758001757269, + 61.51649571682452, + -32.51877900985289, + -48.376587517032775, + -58.02735967650854, + 89.79197789644661, + -84.53326629430444, + -58.23252607768894, + -76.14168597373077, + -59.05887786348942, + 77.38546821194151, + -98.67289449592316, + -63.611559926077675, + 26.857246203003186, + 83.70417131490925, + 76.56606838780263, + -47.83436545380422 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.7380040884017944, + 0.43789437413215637, + 0.9090799689292908, + -0.23584702610969543, + 0.9988471865653992, + 0.48416373133659363, + -0.7358400821685791, + 0.24218930304050446, + 0.25266921520233154, + 0.4510514736175537, + -0.31276169419288635, + 0.09197491407394409, + -0.2537800967693329, + -0.9583188891410828, + -0.11282006651163101, + 0.736129879951477, + -0.80721116065979, + -0.4045141637325287, + -0.283336341381073, + 0.7111190557479858, + -0.1531042903661728, + -0.43673399090766907, + 0.39213326573371887, + -0.7580515146255493 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/div.json b/testing/web-platform/tests/webnn/resources/test_data/div.json new file mode 100644 index 0000000000..d72544e8ec --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/div.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "div float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -95.02903333542001, + 62.804865007594174, + -85.32865597192423, + -68.20919717822437, + 79.45568261298038, + -68.69049322917093, + -94.46466465496823, + -10.000411029009541, + 18.318865013229242, + -3.623280011603569, + -5.957828048196006, + 89.49882849628409, + 94.95791079054848, + -79.00059056550418, + -79.87597038424425, + 74.997874802068, + 25.86537368134097, + 91.54433121797925, + 81.65287344691947, + 48.214831959279195, + 63.37012091471408, + 10.62638472655793, + 46.12662564540156, + 77.2232730204774 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + -0.6358450651168823, + -1.3840086460113525, + 0.22848258912563324, + 0.22211983799934387, + 0.16934208571910858, + -0.6614248752593994, + -0.6466212868690491, + -7.071591854095459, + -1.7074518203735352, + -15.478666305541992, + -6.544795513153076, + -0.036596786230802536, + 0.3400382697582245, + 0.046538159251213074, + -1.1071529388427734, + 0.19159291684627533, + 0.5390679836273193, + 0.18418607115745544, + 0.058991268277168274, + 0.9158834218978882, + -0.20645710825920105, + 4.193900108337402, + -0.7564564943313599, + -0.9594743251800537 + ], + "type": "float32" + } + }, + { + "name": "div float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -95.02903333542001, + 62.804865007594174, + -85.32865597192423, + -68.20919717822437, + 79.45568261298038, + -68.69049322917093, + -94.46466465496823, + -10.000411029009541, + 18.318865013229242, + -3.623280011603569, + -5.957828048196006, + 89.49882849628409, + 94.95791079054848, + -79.00059056550418, + -79.87597038424425, + 74.997874802068, + 25.86537368134097, + 91.54433121797925, + 81.65287344691947, + 48.214831959279195, + 63.37012091471408, + 10.62638472655793, + 46.12662564540156, + 77.2232730204774 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + -0.6358450651168823, + -1.3840086460113525, + 0.22848258912563324, + 0.22211983799934387, + 0.16934208571910858, + -0.6614248752593994, + -0.6466212868690491, + -7.071591854095459, + -1.7074518203735352, + -15.478666305541992, + -6.544795513153076, + -0.036596786230802536, + 0.3400382697582245, + 0.046538159251213074, + -1.1071529388427734, + 0.19159291684627533, + 0.5390679836273193, + 0.18418607115745544, + 0.058991268277168274, + 0.9158834218978882, + -0.20645710825920105, + 4.193900108337402, + -0.7564564943313599, + -0.9594743251800537 + ], + "type": "float32" + } + }, + { + "name": "div float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -95.02903333542001, + 62.804865007594174, + -85.32865597192423, + -68.20919717822437, + 79.45568261298038, + -68.69049322917093, + -94.46466465496823, + -10.000411029009541, + 18.318865013229242, + -3.623280011603569, + -5.957828048196006, + 89.49882849628409, + 94.95791079054848, + -79.00059056550418, + -79.87597038424425, + 74.997874802068, + 25.86537368134097, + 91.54433121797925, + 81.65287344691947, + 48.214831959279195, + 63.37012091471408, + 10.62638472655793, + 46.12662564540156, + 77.2232730204774 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + -0.6358450651168823, + -1.3840086460113525, + 0.22848258912563324, + 0.22211983799934387, + 0.16934208571910858, + -0.6614248752593994, + -0.6466212868690491, + -7.071591854095459, + -1.7074518203735352, + -15.478666305541992, + -6.544795513153076, + -0.036596786230802536, + 0.3400382697582245, + 0.046538159251213074, + -1.1071529388427734, + 0.19159291684627533, + 0.5390679836273193, + 0.18418607115745544, + 0.058991268277168274, + 0.9158834218978882, + -0.20645710825920105, + 4.193900108337402, + -0.7564564943313599, + -0.9594743251800537 + ], + "type": "float32" + } + }, + { + "name": "div float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -95.02903333542001, + 62.804865007594174, + -85.32865597192423, + -68.20919717822437, + 79.45568261298038, + -68.69049322917093, + -94.46466465496823, + -10.000411029009541, + 18.318865013229242, + -3.623280011603569, + -5.957828048196006, + 89.49882849628409, + 94.95791079054848, + -79.00059056550418, + -79.87597038424425, + 74.997874802068, + 25.86537368134097, + 91.54433121797925, + 81.65287344691947, + 48.214831959279195, + 63.37012091471408, + 10.62638472655793, + 46.12662564540156, + 77.2232730204774 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -0.6358450651168823, + -1.3840086460113525, + 0.22848258912563324, + 0.22211983799934387, + 0.16934208571910858, + -0.6614248752593994, + -0.6466212868690491, + -7.071591854095459, + -1.7074518203735352, + -15.478666305541992, + -6.544795513153076, + -0.036596786230802536, + 0.3400382697582245, + 0.046538159251213074, + -1.1071529388427734, + 0.19159291684627533, + 0.5390679836273193, + 0.18418607115745544, + 0.058991268277168274, + 0.9158834218978882, + -0.20645710825920105, + 4.193900108337402, + -0.7564564943313599, + -0.9594743251800537 + ], + "type": "float32" + } + }, + { + "name": "div float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -95.02903333542001, + 62.804865007594174, + -85.32865597192423, + -68.20919717822437, + 79.45568261298038, + -68.69049322917093, + -94.46466465496823, + -10.000411029009541, + 18.318865013229242, + -3.623280011603569, + -5.957828048196006, + 89.49882849628409, + 94.95791079054848, + -79.00059056550418, + -79.87597038424425, + 74.997874802068, + 25.86537368134097, + 91.54433121797925, + 81.65287344691947, + 48.214831959279195, + 63.37012091471408, + 10.62638472655793, + 46.12662564540156, + 77.2232730204774 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + -0.6358450651168823, + -1.3840086460113525, + 0.22848258912563324, + 0.22211983799934387, + 0.16934208571910858, + -0.6614248752593994, + -0.6466212868690491, + -7.071591854095459, + -1.7074518203735352, + -15.478666305541992, + -6.544795513153076, + -0.036596786230802536, + 0.3400382697582245, + 0.046538159251213074, + -1.1071529388427734, + 0.19159291684627533, + 0.5390679836273193, + 0.18418607115745544, + 0.058991268277168274, + 0.9158834218978882, + -0.20645710825920105, + 4.193900108337402, + -0.7564564943313599, + -0.9594743251800537 + ], + "type": "float32" + } + }, + { + "name": "div float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + -41.8274145895075 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -0.6922348141670227, + 0.48120367527008057, + 2.145423412322998, + 2.7607734203338623, + -3.10864520072937, + -0.9206274151802063, + -0.6847651600837708, + -0.5914608240127563, + 1.337254285812378, + -0.7458055019378662, + -1.0726968050003052, + 12.770289421081543, + -1.2953946590423584, + 11.376836776733398, + -0.4729740023612976, + -2.910935878753662, + -2.999844551086426, + -2.48069167137146, + -8.683640480041504, + -0.9471967220306396, + 3.1970295906066895, + -0.9385499358177185, + 1.19874107837677, + 0.5645201802253723 + ], + "type": "float32" + } + }, + { + "name": "div float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + 97.32406923941622, + 36.32521858437477, + 26.03785877293791, + 99.4716629828894, + 10.39552272141377, + -30.788942189398625 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 0.6208509802818298, + -2.3928961753845215, + -0.7487602233886719, + -0.15231086313724518, + 1.2943254709243774, + -1.4756466150283813, + 0.627623438835144, + 1.946824550628662, + -1.2012730836868286, + 0.5638142228126526, + 3.7509193420410156, + 0.106381356716156, + 0.33177119493484497, + -0.10121183097362518, + 3.396397352218628, + 0.14445380866527557, + 1.3412691354751587, + -0.5476378798484802, + 0.049492448568344116, + 1.2156614065170288, + -0.5024688243865967, + 0.4480270743370056, + -3.356520175933838, + 2.4065051078796387 + ], + "type": "float32" + } + }, + { + "name": "div float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 75.08295083033457, + -46.22666869833023, + 15.761880659498928, + 8.922299330668352 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 0.8047597408294678, + -1.1576858758926392, + -0.2596609592437744, + 0.3277462124824524, + -0.2910698652267456, + -0.9828438758850098, + 3.8753535747528076, + 4.48669958114624, + -1.9844446182250977, + 6.285772323608398, + 4.370259761810303, + -0.36709925532341003, + 0.4300486445426941, + -0.04896639660000801, + 1.177829384803772, + -0.3108392059803009, + -0.30162662267684937, + -0.36475029587745667, + 0.3055984377861023, + 2.801643133163452, + -0.830053985118866, + 4.994900703430176, + -3.910738945007324, + -8.304333686828613 + ], + "type": "float32" + } + }, + { + "name": "div float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + -41.8274145895075 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 60.42374184854583, + -86.92247771592565, + -19.496113538677307, + -15.150616021872224, + 13.455190756956796, + 45.4335994568701, + 61.08286131089616, + 70.71882919883615, + -31.27858011424047, + 56.083543107783214, + 38.99276571709217, + -3.275369300234928, + 32.289323532099786, + -3.676541725498467, + 88.4349140505588, + 14.369060854798647, + 13.94319409117783, + 16.861190475721344, + 4.816806540352701, + 44.15916607007162, + -13.083211898368276, + 44.565997906464105, + -34.892785072690245, + -74.09375203216162 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -0.6922348141670227, + 0.48120367527008057, + 2.145423412322998, + 2.7607734203338623, + -3.10864520072937, + -0.9206274151802063, + -0.6847651600837708, + -0.5914608240127563, + 1.337254285812378, + -0.7458055019378662, + -1.0726968050003052, + 12.770289421081543, + -1.2953946590423584, + 11.376836776733398, + -0.4729740023612976, + -2.910935878753662, + -2.999844551086426, + -2.48069167137146, + -8.683640480041504, + -0.9471967220306396, + 3.1970295906066895, + -0.9385499358177185, + 1.19874107837677, + 0.5645201802253723 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/elu.json b/testing/web-platform/tests/webnn/resources/test_data/elu.json new file mode 100644 index 0000000000..68c0c80c59 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/elu.json @@ -0,0 +1,472 @@ +{ // elu: The calculation follows the expression max(0, x) + alpha * (exp(min(0, x)) - 1). + "tests": [ + { + "name": "elu float32 1D tensor default options", // default options: {alpha: 1} + "inputs": { + "x": { + "shape": [24], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.9790657162666321, + 1.3590080738067627, + -0.9790199995040894, + 7.839725494384766, + -0.9987577199935913, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.999400794506073, + 5.665064334869385, + -0.9987848997116089, + -0.9643816947937012, + -0.7019122838973999, + 7.255547046661377, + 8.903468132019043, + -0.982044517993927, + 7.114678382873535, + -0.10607059299945831, + -0.9749990105628967, + 6.135150909423828, + -0.99994957447052 + ], + "type": "float32" + } + }, + { + "name": "elu float32 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.9790657162666321, + 1.3590080738067627, + -0.9790199995040894, + 7.839725494384766, + -0.9987577199935913, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.999400794506073, + 5.665064334869385, + -0.9987848997116089, + -0.9643816947937012, + -0.7019122838973999, + 7.255547046661377, + 8.903468132019043, + -0.982044517993927, + 7.114678382873535, + -0.10607059299945831, + -0.9749990105628967, + 6.135150909423828, + -0.99994957447052 + ], + "type": "float32" + } + }, + { + "name": "elu float32 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.9790657162666321, + 1.3590080738067627, + -0.9790199995040894, + 7.839725494384766, + -0.9987577199935913, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.999400794506073, + 5.665064334869385, + -0.9987848997116089, + -0.9643816947937012, + -0.7019122838973999, + 7.255547046661377, + 8.903468132019043, + -0.982044517993927, + 7.114678382873535, + -0.10607059299945831, + -0.9749990105628967, + 6.135150909423828, + -0.99994957447052 + ], + "type": "float32" + } + }, + { + "name": "elu float32 4D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.9790657162666321, + 1.3590080738067627, + -0.9790199995040894, + 7.839725494384766, + -0.9987577199935913, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.999400794506073, + 5.665064334869385, + -0.9987848997116089, + -0.9643816947937012, + -0.7019122838973999, + 7.255547046661377, + 8.903468132019043, + -0.982044517993927, + 7.114678382873535, + -0.10607059299945831, + -0.9749990105628967, + 6.135150909423828, + -0.99994957447052 + ], + "type": "float32" + } + }, + { + "name": "elu float32 5D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.9790657162666321, + 1.3590080738067627, + -0.9790199995040894, + 7.839725494384766, + -0.9987577199935913, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.999400794506073, + 5.665064334869385, + -0.9987848997116089, + -0.9643816947937012, + -0.7019122838973999, + 7.255547046661377, + 8.903468132019043, + -0.982044517993927, + 7.114678382873535, + -0.10607059299945831, + -0.9749990105628967, + 6.135150909423828, + -0.99994957447052 + ], + "type": "float32" + } + }, + { + "name": "elu float32 4D tensor positive options.alpha", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "options": { + "alpha": 0.3607245505146506 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + -0.35317301750183105, + 1.3590080738067627, + -0.35315653681755066, + 7.839725494384766, + -0.36027640104293823, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + -0.36050841212272644, + 5.665064334869385, + -0.3602862060070038, + -0.3478761315345764, + -0.25319698452949524, + 7.255547046661377, + 8.903468132019043, + -0.3542475700378418, + 7.114678382873535, + -0.0382622666656971, + -0.3517060875892639, + 6.135150909423828, + -0.3607063591480255 + ], + "type": "float32" + } + }, + { + "name": "elu float32 4D tensor negative options.alpha", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 4.721739616402454, + 0.37687805459885837, + 1.4189998297338988, + -3.866366516102673, + 1.3590080831697868, + -3.8641844556612392, + 7.839725573639406, + -6.690801377003339, + 0.545640671378024, + 5.776711453839759, + 7.263273186498619, + -7.419948093040434, + 5.665064356187175, + -6.712906923265587, + -3.3348948531721945, + -1.2103675328053143, + 7.255546982014842, + 8.903468527480992, + -4.019860311974934, + 7.114678383091487, + -0.11212847159184136, + -3.688840965850466, + 6.135151096361078, + -9.895182558358613 + ], + "type": "float32" + } + }, + "options": { + "alpha": -3.468180406374035 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 4.721739768981934, + 0.3768780529499054, + 1.4189997911453247, + 3.3955764770507812, + 1.3590080738067627, + 3.3954179286956787, + 7.839725494384766, + 3.463871955871582, + 0.5456406474113464, + 5.776711463928223, + 7.263273239135742, + 3.466102361679077, + 5.665064334869385, + 3.463966131210327, + 3.34464955329895, + 2.434358596801758, + 7.255547046661377, + 8.903468132019043, + 3.40590763092041, + 7.114678382873535, + 0.3678719699382782, + 3.381472587585449, + 6.135150909423828, + 3.468005657196045 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/exp.json b/testing/web-platform/tests/webnn/resources/test_data/exp.json new file mode 100644 index 0000000000..886729f2e8 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/exp.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "exp float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 1.5401084737753479, + 12.774433809954473, + 61.46073034406041, + 30.371593690722648, + -23.07019138708837, + 6.286732075092644, + 24.049592392056553, + 59.17023846672603, + -72.39779325866608, + 76.17325870390891, + 42.745124211838345, + 31.50150770254453, + 15.485609808293518, + -11.397760090390022, + 50.36123123038939, + -83.05469409695672, + 24.110038122659418, + -28.330545051670825, + -53.749036944957986, + -78.11921866998134, + -83.41683875349166, + -89.72063026731117, + -68.90046001676907, + -71.89803038543928 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 4.665096282958984, + 353074.40625, + 4.92103607186909e+26, + 15495851933696, + 9.566272773930962e-11, + 537.3943481445312, + 27835916288, + 4.980902673917305e+25, + 3.614401801447914e-32, + 1.2067705660062333e+33, + 3664138167604216000, + 47965678862336, + 5312696, + 0.000011220586202398408, + 7.440557948065475e+21, + 8.507544403157469e-37, + 29570371584, + 4.968216051233487e-13, + 4.54034731570652e-24, + 1.1837368161912076e-34, + 5.922797145303594e-37, + 1.0834951830036632e-39, + 1.1937427251244527e-30, + 5.957731569649706e-32 + ], + "type": "float32" + } + }, + { + "name": "exp float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 1.5401084737753479, + 12.774433809954473, + 61.46073034406041, + 30.371593690722648, + -23.07019138708837, + 6.286732075092644, + 24.049592392056553, + 59.17023846672603, + -72.39779325866608, + 76.17325870390891, + 42.745124211838345, + 31.50150770254453, + 15.485609808293518, + -11.397760090390022, + 50.36123123038939, + -83.05469409695672, + 24.110038122659418, + -28.330545051670825, + -53.749036944957986, + -78.11921866998134, + -83.41683875349166, + -89.72063026731117, + -68.90046001676907, + -71.89803038543928 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 4.665096282958984, + 353074.40625, + 4.92103607186909e+26, + 15495851933696, + 9.566272773930962e-11, + 537.3943481445312, + 27835916288, + 4.980902673917305e+25, + 3.614401801447914e-32, + 1.2067705660062333e+33, + 3664138167604216000, + 47965678862336, + 5312696, + 0.000011220586202398408, + 7.440557948065475e+21, + 8.507544403157469e-37, + 29570371584, + 4.968216051233487e-13, + 4.54034731570652e-24, + 1.1837368161912076e-34, + 5.922797145303594e-37, + 1.0834951830036632e-39, + 1.1937427251244527e-30, + 5.957731569649706e-32 + ], + "type": "float32" + } + }, + { + "name": "exp float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 1.5401084737753479, + 12.774433809954473, + 61.46073034406041, + 30.371593690722648, + -23.07019138708837, + 6.286732075092644, + 24.049592392056553, + 59.17023846672603, + -72.39779325866608, + 76.17325870390891, + 42.745124211838345, + 31.50150770254453, + 15.485609808293518, + -11.397760090390022, + 50.36123123038939, + -83.05469409695672, + 24.110038122659418, + -28.330545051670825, + -53.749036944957986, + -78.11921866998134, + -83.41683875349166, + -89.72063026731117, + -68.90046001676907, + -71.89803038543928 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 4.665096282958984, + 353074.40625, + 4.92103607186909e+26, + 15495851933696, + 9.566272773930962e-11, + 537.3943481445312, + 27835916288, + 4.980902673917305e+25, + 3.614401801447914e-32, + 1.2067705660062333e+33, + 3664138167604216000, + 47965678862336, + 5312696, + 0.000011220586202398408, + 7.440557948065475e+21, + 8.507544403157469e-37, + 29570371584, + 4.968216051233487e-13, + 4.54034731570652e-24, + 1.1837368161912076e-34, + 5.922797145303594e-37, + 1.0834951830036632e-39, + 1.1937427251244527e-30, + 5.957731569649706e-32 + ], + "type": "float32" + } + }, + { + "name": "exp float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 1.5401084737753479, + 12.774433809954473, + 61.46073034406041, + 30.371593690722648, + -23.07019138708837, + 6.286732075092644, + 24.049592392056553, + 59.17023846672603, + -72.39779325866608, + 76.17325870390891, + 42.745124211838345, + 31.50150770254453, + 15.485609808293518, + -11.397760090390022, + 50.36123123038939, + -83.05469409695672, + 24.110038122659418, + -28.330545051670825, + -53.749036944957986, + -78.11921866998134, + -83.41683875349166, + -89.72063026731117, + -68.90046001676907, + -71.89803038543928 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 4.665096282958984, + 353074.40625, + 4.92103607186909e+26, + 15495851933696, + 9.566272773930962e-11, + 537.3943481445312, + 27835916288, + 4.980902673917305e+25, + 3.614401801447914e-32, + 1.2067705660062333e+33, + 3664138167604216000, + 47965678862336, + 5312696, + 0.000011220586202398408, + 7.440557948065475e+21, + 8.507544403157469e-37, + 29570371584, + 4.968216051233487e-13, + 4.54034731570652e-24, + 1.1837368161912076e-34, + 5.922797145303594e-37, + 1.0834951830036632e-39, + 1.1937427251244527e-30, + 5.957731569649706e-32 + ], + "type": "float32" + } + }, + { + "name": "exp float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 1.5401084737753479, + 12.774433809954473, + 61.46073034406041, + 30.371593690722648, + -23.07019138708837, + 6.286732075092644, + 24.049592392056553, + 59.17023846672603, + -72.39779325866608, + 76.17325870390891, + 42.745124211838345, + 31.50150770254453, + 15.485609808293518, + -11.397760090390022, + 50.36123123038939, + -83.05469409695672, + 24.110038122659418, + -28.330545051670825, + -53.749036944957986, + -78.11921866998134, + -83.41683875349166, + -89.72063026731117, + -68.90046001676907, + -71.89803038543928 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 4.665096282958984, + 353074.40625, + 4.92103607186909e+26, + 15495851933696, + 9.566272773930962e-11, + 537.3943481445312, + 27835916288, + 4.980902673917305e+25, + 3.614401801447914e-32, + 1.2067705660062333e+33, + 3664138167604216000, + 47965678862336, + 5312696, + 0.000011220586202398408, + 7.440557948065475e+21, + 8.507544403157469e-37, + 29570371584, + 4.968216051233487e-13, + 4.54034731570652e-24, + 1.1837368161912076e-34, + 5.922797145303594e-37, + 1.0834951830036632e-39, + 1.1937427251244527e-30, + 5.957731569649706e-32 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/floor.json b/testing/web-platform/tests/webnn/resources/test_data/floor.json new file mode 100644 index 0000000000..f2fa797d41 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/floor.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "floor float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 89.69458425635187, + -79.6715006046712, + -66.80949305244779, + -71.88439187517632, + 86.33935218844132, + 6.823808491438228, + 24.908446694609452, + 0.9734055387608578, + 19.94818517399692, + 0.8437776596471878, + -24.75293941821147, + 77.76482131339927, + -33.64446543048625, + 80.77624589277926, + 44.47844134603099, + -37.65005913863395, + -83.78780150071003, + 65.84009074464839, + -39.83677499773579, + 32.52575852910243, + -21.21354337121204, + -80.30910898865443, + 16.674850201817335, + -72.88893024677465 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 89, + -80, + -67, + -72, + 86, + 6, + 24, + 0, + 19, + 0, + -25, + 77, + -34, + 80, + 44, + -38, + -84, + 65, + -40, + 32, + -22, + -81, + 16, + -73 + ], + "type": "float32" + } + }, + { + "name": "floor float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 89.69458425635187, + -79.6715006046712, + -66.80949305244779, + -71.88439187517632, + 86.33935218844132, + 6.823808491438228, + 24.908446694609452, + 0.9734055387608578, + 19.94818517399692, + 0.8437776596471878, + -24.75293941821147, + 77.76482131339927, + -33.64446543048625, + 80.77624589277926, + 44.47844134603099, + -37.65005913863395, + -83.78780150071003, + 65.84009074464839, + -39.83677499773579, + 32.52575852910243, + -21.21354337121204, + -80.30910898865443, + 16.674850201817335, + -72.88893024677465 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 89, + -80, + -67, + -72, + 86, + 6, + 24, + 0, + 19, + 0, + -25, + 77, + -34, + 80, + 44, + -38, + -84, + 65, + -40, + 32, + -22, + -81, + 16, + -73 + ], + "type": "float32" + } + }, + { + "name": "floor float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 89.69458425635187, + -79.6715006046712, + -66.80949305244779, + -71.88439187517632, + 86.33935218844132, + 6.823808491438228, + 24.908446694609452, + 0.9734055387608578, + 19.94818517399692, + 0.8437776596471878, + -24.75293941821147, + 77.76482131339927, + -33.64446543048625, + 80.77624589277926, + 44.47844134603099, + -37.65005913863395, + -83.78780150071003, + 65.84009074464839, + -39.83677499773579, + 32.52575852910243, + -21.21354337121204, + -80.30910898865443, + 16.674850201817335, + -72.88893024677465 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 89, + -80, + -67, + -72, + 86, + 6, + 24, + 0, + 19, + 0, + -25, + 77, + -34, + 80, + 44, + -38, + -84, + 65, + -40, + 32, + -22, + -81, + 16, + -73 + ], + "type": "float32" + } + }, + { + "name": "floor float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 89.69458425635187, + -79.6715006046712, + -66.80949305244779, + -71.88439187517632, + 86.33935218844132, + 6.823808491438228, + 24.908446694609452, + 0.9734055387608578, + 19.94818517399692, + 0.8437776596471878, + -24.75293941821147, + 77.76482131339927, + -33.64446543048625, + 80.77624589277926, + 44.47844134603099, + -37.65005913863395, + -83.78780150071003, + 65.84009074464839, + -39.83677499773579, + 32.52575852910243, + -21.21354337121204, + -80.30910898865443, + 16.674850201817335, + -72.88893024677465 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 89, + -80, + -67, + -72, + 86, + 6, + 24, + 0, + 19, + 0, + -25, + 77, + -34, + 80, + 44, + -38, + -84, + 65, + -40, + 32, + -22, + -81, + 16, + -73 + ], + "type": "float32" + } + }, + { + "name": "floor float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 89.69458425635187, + -79.6715006046712, + -66.80949305244779, + -71.88439187517632, + 86.33935218844132, + 6.823808491438228, + 24.908446694609452, + 0.9734055387608578, + 19.94818517399692, + 0.8437776596471878, + -24.75293941821147, + 77.76482131339927, + -33.64446543048625, + 80.77624589277926, + 44.47844134603099, + -37.65005913863395, + -83.78780150071003, + 65.84009074464839, + -39.83677499773579, + 32.52575852910243, + -21.21354337121204, + -80.30910898865443, + 16.674850201817335, + -72.88893024677465 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 89, + -80, + -67, + -72, + 86, + 6, + 24, + 0, + 19, + 0, + -25, + 77, + -34, + 80, + 44, + -38, + -84, + 65, + -40, + 32, + -22, + -81, + 16, + -73 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/gemm.json b/testing/web-platform/tests/webnn/resources/test_data/gemm.json new file mode 100644 index 0000000000..3738e19f7c --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/gemm.json @@ -0,0 +1,1856 @@ +{ + "tests": [ + { + "name": "gemm two float32 2D tensors (b is non-constant) default options", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors default options", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + // options.c + { + "name": "gemm two float32 2D tensors options.c", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8243.9189453125, + 14117.208984375, + 14620.15234375, + 14068.654296875, + 18825.609375, + 11927.712890625, + 14673.310546875, + 19176.533203125, + 15122.8896484375, + 18303.658203125, + 5586.16064453125, + 9266.43359375, + 9195.7294921875, + 6438.0244140625, + 10939.8330078125 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors broadcast options.c [1, 5] => [3, 5]", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [1, 5], + "data": [ + 85.90813142403118, + 39.375354775876346, + 50.94260262706696, + 31.87430758223413, + 31.210525151769097 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8247.0546875, + 14065.19921875, + 14658.443359375, + 14080.40625, + 18788.30859375, + 11978.4189453125, + 14699.3505859375, + 19176.689453125, + 15066.1513671875, + 18304.291015625, + 5602.5986328125, + 9298.642578125, + 9218.3349609375, + 6379.20458984375, + 10899.8125 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors broadcast options.c [3, 1] => [3, 5]", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 1], + "data": [ + 6.2025197606838445, + 81.40642123187278, + 73.00516839070796 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8167.349609375, + 14032.0263671875, + 14613.703125, + 14054.734375, + 18763.30078125, + 11973.9169921875, + 14741.3818359375, + 19207.154296875, + 15115.68359375, + 18354.486328125, + 5589.6953125, + 9332.2724609375, + 9240.3974609375, + 6420.33544921875, + 10941.607421875 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors broadcast options.c [1, 1] => [3, 5]", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [1, 1], + "data": [18.78192846614879], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8179.9287109375, + 14044.6064453125, + 14626.2822265625, + 14067.314453125, + 18775.87890625, + 11911.29296875, + 14678.7578125, + 19144.529296875, + 15053.0595703125, + 18291.86328125, + 5535.47216796875, + 9278.048828125, + 9186.173828125, + 6366.1123046875, + 10887.384765625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors broadcast options.c [5] => [3, 5]", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [5], + "data": [ + 85.90813142403118, + 39.375354775876346, + 50.94260262706696, + 31.87430758223413, + 31.210525151769097 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8247.0546875, + 14065.19921875, + 14658.443359375, + 14080.40625, + 18788.30859375, + 11978.4189453125, + 14699.3505859375, + 19176.689453125, + 15066.1513671875, + 18304.291015625, + 5602.5986328125, + 9298.642578125, + 9218.3349609375, + 6379.20458984375, + 10899.8125 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors broadcast options.c [1] => [3, 5]", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [1], + "data": [18.78192846614879], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8179.9287109375, + 14044.6064453125, + 14626.2822265625, + 14067.314453125, + 18775.87890625, + 11911.29296875, + 14678.7578125, + 19144.529296875, + 15053.0595703125, + 18291.86328125, + 5535.47216796875, + 9278.048828125, + 9186.173828125, + 6366.1123046875, + 10887.384765625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors scalar options.c", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": 18.78192846614879 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8179.9287109375, + 14044.6064453125, + 14626.2822265625, + 14067.314453125, + 18775.87890625, + 11911.29296875, + 14678.7578125, + 19144.529296875, + 15053.0595703125, + 18291.86328125, + 5535.47216796875, + 9278.048828125, + 9186.173828125, + 6366.1123046875, + 10887.384765625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.alpha", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "alpha": 74.43204170482103 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 607450.875, + 1043970.75, + 1087266.125, + 1045661, + 1396129.125, + 885183.875, + 1091172, + 1423568.5, + 1119032, + 1360102.75, + 410618.53125, + 689186.1875, + 682347.75, + 472444.78125, + 808972.3125 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.beta", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "beta": 62.01828598608989 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.c and options.beta", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + }, + "beta": 62.01828598608989 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 13294.525390625, + 19693.37890625, + 15392.1494140625, + 15296.4638671875, + 23006.109375, + 14075.7041015625, + 15486.96875, + 22275.375, + 20529.83984375, + 20169.443359375, + 9825.138671875, + 9703.7041015625, + 10924.810546875, + 11972.0244140625, + 15286.1806640625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.aTranspose being true", + "inputs": { + "a": { + "shape": [4, 3], + "data": [ + 82.98884511142329, + 18.96485038946509, + 50.51683887619669, + 90.51641254722982, + 43.89479290862091, + 40.45679629199866, + 59.6385201162642, + 98.89487912764056, + 50.76741460760452, + 36.27187180381433, + 91.46013741088626, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "aTranspose": true + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.aTranspose being explicit false", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "aTranspose": false + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.bTranspose being true", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [5, 4], + "data": [ + 25.14739246484985, + 0.003725653326558387, + 75.74880854000601, + 42.90679144336773, + 66.69238549579231, + 16.499146388625483, + 96.6068806977233, + 34.08055187293266, + 63.29909902139696, + 3.0366680571384252, + 99.10042039275365, + 87.37654561544477, + 10.629964783998469, + 93.14021782678614, + 23.243775283337477, + 92.34209530787089, + 61.32737573972831, + 70.08265680040718, + 86.1185682132947, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bTranspose": true + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + { + "name": "gemm two float32 2D tensors options.bTranspose being explicit false", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "bTranspose": false + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8161.14697265625, + 14025.82421875, + 14607.5009765625, + 14048.5322265625, + 18757.09765625, + 11892.5107421875, + 14659.9755859375, + 19125.74609375, + 15034.27734375, + 18273.080078125, + 5516.6904296875, + 9259.267578125, + 9167.3916015625, + 6347.330078125, + 10868.6025390625 + ], + "type": "float32" + } + }, + // alpha * A x B + beta * C + { + "name": "gemm two float32 2D tensors all options", // All alpha, A, B, beta and C are positive + "inputs": { + "a": { + "shape": [4, 3], + "data": [ + 82.98884511142329, + 18.96485038946509, + 50.51683887619669, + 90.51641254722982, + 43.89479290862091, + 40.45679629199866, + 59.6385201162642, + 98.89487912764056, + 50.76741460760452, + 36.27187180381433, + 91.46013741088626, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [5, 4], + "data": [ + 25.14739246484985, + 0.003725653326558387, + 75.74880854000601, + 42.90679144336773, + 66.69238549579231, + 16.499146388625483, + 96.6068806977233, + 34.08055187293266, + 63.29909902139696, + 3.0366680571384252, + 99.10042039275365, + 87.37654561544477, + 10.629964783998469, + 93.14021782678614, + 23.243775283337477, + 92.34209530787089, + 61.32737573972831, + 70.08265680040718, + 86.1185682132947, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + }, + "alpha": 74.43204170482103, + "beta": 62.01828598608989, + "aTranspose": true, + "bTranspose": true + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 612584.25, + 1049638.375, + 1088050.75, + 1046908.875, + 1400378.125, + 887367.0625, + 1091999, + 1426718.125, + 1124527.625, + 1361999.125, + 414927, + 689630.625, + 684105.1875, + 478069.46875, + 813389.875 + ], + "type": "float32" + } + }, + { + "name": "gemm both negative options.alpha and 1st float32 input tensor", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + -87.94973451710236, + -14.765121645895519, + -80.86310680534218, + -59.27638399609938, + -28.748250806066665, + -9.038779559502402, + -76.04662906780386, + -83.94807592959552, + -95.02689722012639, + -47.897331378960686, + -69.01161938187514, + -86.66899315604435 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + }, + "alpha": -22.611149749186296 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 246101.234375, + 360542.34375, + 425213.25, + 218520.65625, + 383734.40625, + 228076.8125, + 277543.625, + 378076, + 241282.15625, + 316800.71875, + 256391.5625, + 378711.34375, + 465195.8125, + 341034.875, + 460338.3125 + ], + "type": "float32" + } + }, + { + "name": "gemm both negative options.alpha and 2nd float32 input tensor", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + -64.35197380859643, + -87.64981186480712, + -96.04495397065658, + -31.07155980709375, + -6.548066933465876, + -64.64146348646094, + -14.020616857474465, + -88.93306726614543, + -24.17941082566574, + -97.31866304932058, + -93.46081221136554, + -39.49039520100528, + -94.37982420323672, + -75.8333604154835, + -11.403324388031308, + -26.28259194817595, + -56.237981538646295, + -46.474048229320665, + -89.20683997562287, + -53.49532488423292 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + }, + "alpha": -22.611149749186296 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 400725.03125, + 292635.75, + 527642.375, + 283236.40625, + 270787.40625, + 355130.96875, + 256121.421875, + 436658.0625, + 391465.40625, + 235557.03125, + 245540.5625, + 170154.125, + 309239.4375, + 163583.015625, + 120958.7578125 + ], + "type": "float32" + } + }, + { + "name": "gemm both negative options.beta and 3rd float32 input tensor (options.c)", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + -42.66268253622787, + -93.66379731044412, + -40.7084931979834, + -45.060979792171786, + -87.90339205403255, + -71.16189172949525, + -85.56422647952868, + -10.049133962829984, + -46.105405162474256, + -66.76168168609703, + -25.392492019110875, + -65.6298788225413, + -40.50155350367264, + -81.5303936185148, + -41.396294482178405 + ], + "type": "float32" + }, + "beta": -11.68521964935509 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 8659.669921875, + 15120.3056640625, + 15083.1884765625, + 14575.0791015625, + 19784.267578125, + 12724.052734375, + 15659.8125, + 19243.173828125, + 15573.029296875, + 19053.205078125, + 5813.4072265625, + 10026.1669921875, + 9640.6611328125, + 7300.03076171875, + 11352.3271484375 + ], + "type": "float32" + } + }, + { + "name": "gemm both negative options.alpha and options.beta", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + 82.77202028708963, + 91.38520749770859, + 12.651897708721549, + 20.12200327935334, + 68.51224585053419, + 35.2024171023056, + 13.33466578964102, + 50.785469741049205, + 88.61195160882922, + 30.577471042677097, + 69.47062151883239, + 7.166217909076766, + 28.337108113083744, + 90.69412588106762, + 71.23025762837965 + ], + "type": "float32" + }, + "alpha": -22.611149749186296, + "beta": -11.68521964935509 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + -185500.109375, + -318207.84375, + -330440.21875, + -317888.59375, + -424920.125, + -269314.6875, + -331634.71875, + -433048.5625, + -340977.71875, + -413532.65625, + -125550.484375, + -209446.40625, + -207616.390625, + -144580.21875, + -246583.921875 + ], + "type": "float32" + } + }, + { + "name": "gemm both negative options.alpha and 3rd float32 input tensor (options.c)", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 82.98884511142329, + 90.51641254722982, + 59.6385201162642, + 36.27187180381433, + 18.96485038946509, + 43.89479290862091, + 98.89487912764056, + 91.46013741088626, + 50.51683887619669, + 40.45679629199866, + 50.76741460760452, + 9.336554329198155 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 25.14739246484985, + 66.69238549579231, + 63.29909902139696, + 10.629964783998469, + 61.32737573972831, + 0.003725653326558387, + 16.499146388625483, + 3.0366680571384252, + 93.14021782678614, + 70.08265680040718, + 75.74880854000601, + 96.6068806977233, + 99.10042039275365, + 23.243775283337477, + 86.1185682132947, + 42.90679144336773, + 34.08055187293266, + 87.37654561544477, + 92.34209530787089, + 60.32208994273669 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "c": { + "shape": [3, 5], + "data": [ + -42.66268253622787, + -93.66379731044412, + -40.7084931979834, + -45.060979792171786, + -87.90339205403255, + -71.16189172949525, + -85.56422647952868, + -10.049133962829984, + -46.105405162474256, + -66.76168168609703, + -25.392492019110875, + -65.6298788225413, + -40.50155350367264, + -81.5303936185148, + -41.396294482178405 + ], + "type": "float32" + }, + "alpha": -22.611149749186296 + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + -184575.5625, + -317233.65625, + -330333.09375, + -317698.5, + -424207.4375, + -268974.5, + -331564.4375, + -432465.15625, + -339988.375, + -413242.09375, + -124764.09375, + -209428.296875, + -207325.765625, + -143601.96875, + -245792.984375 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/hard_sigmoid.json b/testing/web-platform/tests/webnn/resources/test_data/hard_sigmoid.json new file mode 100644 index 0000000000..22fe7c6da0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/hard_sigmoid.json @@ -0,0 +1,890 @@ +{ // hardSigmoid: Calculate the non-smooth function used in place of a sigmoid function on the input tensor. + "tests": [ + { + "name": "hardSigmoid float32 positive 1D tensor default options", // default options: {alpha: 0.2, beta: 0.5} + "inputs": { + "x": { + "shape": [24], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.5118141174316406, + 0.6415218114852905, + 0.6045681238174438, + 0.5846202969551086, + 0.6328738331794739, + 0.6900588274002075, + 0.5218378305435181, + 0.5025954246520996, + 0.5951059460639954, + 0.6064510345458984, + 0.6368615627288818, + 0.5932421684265137, + 0.5609799027442932, + 0.6605174541473389, + 0.5497192740440369, + 0.6327379941940308, + 0.6109522581100464, + 0.6108517050743103, + 0.6462276577949524, + 0.5976191759109497, + 0.6553369164466858, + 0.669111430644989, + 0.6110604405403137, + 0.6120688915252686 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.5118141174316406, + 0.6415218114852905, + 0.6045681238174438, + 0.5846202969551086, + 0.6328738331794739, + 0.6900588274002075, + 0.5218378305435181, + 0.5025954246520996, + 0.5951059460639954, + 0.6064510345458984, + 0.6368615627288818, + 0.5932421684265137, + 0.5609799027442932, + 0.6605174541473389, + 0.5497192740440369, + 0.6327379941940308, + 0.6109522581100464, + 0.6108517050743103, + 0.6462276577949524, + 0.5976191759109497, + 0.6553369164466858, + 0.669111430644989, + 0.6110604405403137, + 0.6120688915252686 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0.5118141174316406, + 0.6415218114852905, + 0.6045681238174438, + 0.5846202969551086, + 0.6328738331794739, + 0.6900588274002075, + 0.5218378305435181, + 0.5025954246520996, + 0.5951059460639954, + 0.6064510345458984, + 0.6368615627288818, + 0.5932421684265137, + 0.5609799027442932, + 0.6605174541473389, + 0.5497192740440369, + 0.6327379941940308, + 0.6109522581100464, + 0.6108517050743103, + 0.6462276577949524, + 0.5976191759109497, + 0.6553369164466858, + 0.669111430644989, + 0.6110604405403137, + 0.6120688915252686 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 4D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.5118141174316406, + 0.6415218114852905, + 0.6045681238174438, + 0.5846202969551086, + 0.6328738331794739, + 0.6900588274002075, + 0.5218378305435181, + 0.5025954246520996, + 0.5951059460639954, + 0.6064510345458984, + 0.6368615627288818, + 0.5932421684265137, + 0.5609799027442932, + 0.6605174541473389, + 0.5497192740440369, + 0.6327379941940308, + 0.6109522581100464, + 0.6108517050743103, + 0.6462276577949524, + 0.5976191759109497, + 0.6553369164466858, + 0.669111430644989, + 0.6110604405403137, + 0.6120688915252686 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 5D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + 0.5118141174316406, + 0.6415218114852905, + 0.6045681238174438, + 0.5846202969551086, + 0.6328738331794739, + 0.6900588274002075, + 0.5218378305435181, + 0.5025954246520996, + 0.5951059460639954, + 0.6064510345458984, + 0.6368615627288818, + 0.5932421684265137, + 0.5609799027442932, + 0.6605174541473389, + 0.5497192740440369, + 0.6327379941940308, + 0.6109522581100464, + 0.6108517050743103, + 0.6462276577949524, + 0.5976191759109497, + 0.6553369164466858, + 0.669111430644989, + 0.6110604405403137, + 0.6120688915252686 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 4D tensor specified positive options.alpha default options.beta", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": 0.7854232544278235 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.546395480632782, + 1, + 0.9106510877609253, + 0.8323138356208801, + 1, + 1, + 0.5857596397399902, + 0.5101925134658813, + 0.8734921216964722, + 0.9180455803871155, + 1, + 0.8661727905273438, + 0.7394752502441406, + 1, + 0.6952533721923828, + 1, + 0.9357223510742188, + 0.9353274703025818, + 1, + 0.8833619952201843, + 1, + 1, + 0.936147153377533, + 0.9401075839996338 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 negative 4D tensor specified negative options.alpha default options.beta", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -0.05907066981577147, + -0.7076089198897, + -0.5228405296259637, + -0.42310158753617455, + -0.6643692569867639, + -0.9502940424761401, + -0.10918906453593258, + -0.012977113903015258, + -0.4755297159390164, + -0.5322551665299613, + -0.684307857800798, + -0.4662107602754757, + -0.3048996433987061, + -0.8025872652109942, + -0.2485963985673023, + -0.6636898942337357, + -0.554761182646025, + -0.5542584257213008, + -0.7311381962152534, + -0.48809603333206986, + -0.7766845231174959, + -0.8455570201933926, + -0.5553020911955322, + -0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": -0.7854232544278235 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.546395480632782, + 1, + 0.9106510877609253, + 0.8323138356208801, + 1, + 1, + 0.5857596397399902, + 0.5101925134658813, + 0.8734921216964722, + 0.9180455803871155, + 1, + 0.8661727905273438, + 0.7394752502441406, + 1, + 0.6952533721923828, + 1, + 0.9357223510742188, + 0.9353274703025818, + 1, + 0.8833619952201843, + 1, + 1, + 0.936147153377533, + 0.9401075839996338 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 4D tensor specified positive options.beta default options.alpha", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "beta": 0.4361860418530341 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.4480001926422119, + 0.577707827091217, + 0.5407541394233704, + 0.5208063721656799, + 0.5690599083900452, + 0.626244843006134, + 0.4580238461494446, + 0.4387814700603485, + 0.5312919616699219, + 0.5426371097564697, + 0.5730476379394531, + 0.5294281840324402, + 0.4971659779548645, + 0.5967035293579102, + 0.48590531945228577, + 0.5689240097999573, + 0.5471382737159729, + 0.5470377206802368, + 0.5824136734008789, + 0.533805251121521, + 0.5915229320526123, + 0.6052974462509155, + 0.5472464561462402, + 0.5482549667358398 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 negative 4D tensor specified negative options.beta default options.alpha", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -0.05907066981577147, + -0.7076089198897, + -0.5228405296259637, + -0.42310158753617455, + -0.6643692569867639, + -0.9502940424761401, + -0.10918906453593258, + -0.012977113903015258, + -0.4755297159390164, + -0.5322551665299613, + -0.684307857800798, + -0.4662107602754757, + -0.3048996433987061, + -0.8025872652109942, + -0.2485963985673023, + -0.6636898942337357, + -0.554761182646025, + -0.5542584257213008, + -0.7311381962152534, + -0.48809603333206986, + -0.7766845231174959, + -0.8455570201933926, + -0.5553020911955322, + -0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "beta": -0.436186041853034 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 4D tensor specified all options (positive options.alpha and positive options.beta)", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": 0.7854232544278235, + "beta": 0.4361860418530341 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.4825815260410309, + 0.9919585585594177, + 0.8468371629714966, + 0.7684998512268066, + 0.9579971432685852, + 1, + 0.5219456553459167, + 0.44637855887413025, + 0.8096781373023987, + 0.8542316555976868, + 0.9736573696136475, + 0.8023588061332703, + 0.6756613254547119, + 1, + 0.6314394474029541, + 0.9574635624885559, + 0.8719083666801453, + 0.8715134859085083, + 1, + 0.8195480108261108, + 1, + 1, + 0.8723332285881042, + 0.8762935996055603 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 positive 4D tensor specified all options (negative options.alpha and negative options.beta)", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 0.05907066981577147, + 0.7076089198897, + 0.5228405296259637, + 0.42310158753617455, + 0.6643692569867639, + 0.9502940424761401, + 0.10918906453593258, + 0.012977113903015258, + 0.4755297159390164, + 0.5322551665299613, + 0.684307857800798, + 0.4662107602754757, + 0.3048996433987061, + 0.8025872652109942, + 0.2485963985673023, + 0.6636898942337357, + 0.554761182646025, + 0.5542584257213008, + 0.7311381962152534, + 0.48809603333206986, + 0.7766845231174959, + 0.8455570201933926, + 0.5553020911955322, + 0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": -0.7854232544278235, + "beta": -0.4361860418530341 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 negative 4D tensor all options (positive options.alpha and negative options.beta)", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -0.05907066981577147, + -0.7076089198897, + -0.5228405296259637, + -0.42310158753617455, + -0.6643692569867639, + -0.9502940424761401, + -0.10918906453593258, + -0.012977113903015258, + -0.4755297159390164, + -0.5322551665299613, + -0.684307857800798, + -0.4662107602754757, + -0.3048996433987061, + -0.8025872652109942, + -0.2485963985673023, + -0.6636898942337357, + -0.554761182646025, + -0.5542584257213008, + -0.7311381962152534, + -0.48809603333206986, + -0.7766845231174959, + -0.8455570201933926, + -0.5553020911955322, + -0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": 0.7854232544278235, + "beta": -0.4361860418530341 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "hardSigmoid float32 negative 4D tensor specified all options (negative options.alpha and positive options.beta)", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -0.05907066981577147, + -0.7076089198897, + -0.5228405296259637, + -0.42310158753617455, + -0.6643692569867639, + -0.9502940424761401, + -0.10918906453593258, + -0.012977113903015258, + -0.4755297159390164, + -0.5322551665299613, + -0.684307857800798, + -0.4662107602754757, + -0.3048996433987061, + -0.8025872652109942, + -0.2485963985673023, + -0.6636898942337357, + -0.554761182646025, + -0.5542584257213008, + -0.7311381962152534, + -0.48809603333206986, + -0.7766845231174959, + -0.8455570201933926, + -0.5553020911955322, + -0.5603444395469193 + ], + "type": "float32" + } + }, + "options": { + "alpha": -0.7854232544278235, + "beta": 0.4361860418530341 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 0.4825815260410309, + 0.9919585585594177, + 0.8468371629714966, + 0.7684998512268066, + 0.9579971432685852, + 1, + 0.5219456553459167, + 0.44637855887413025, + 0.8096781373023987, + 0.8542316555976868, + 0.9736573696136475, + 0.8023588061332703, + 0.6756613254547119, + 1, + 0.6314394474029541, + 0.9574635624885559, + 0.8719083666801453, + 0.8715134859085083, + 1, + 0.8195480108261108, + 1, + 1, + 0.8723332285881042, + 0.8762935996055603 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/hard_swish.json b/testing/web-platform/tests/webnn/resources/test_data/hard_swish.json new file mode 100644 index 0000000000..8d7812d21e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/hard_swish.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "hardSwish float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 0.7341583533045579, + 9.118859151005996, + 3.545238531520827, + 2.621943879280181, + -6.445507690595167, + -1.6835596550754381, + 5.523179785756591, + -5.958856051028132, + -9.169189933081544, + 6.420943542920213, + -3.293031330275471, + 1.0410166785810624, + -7.246322671816956, + -0.9472730969847909, + -5.778352255817807, + 3.185229125228698, + -7.261818072290236, + 4.174602615173795, + 3.7802628241590686, + -6.07124038718255, + -9.909919471919547, + -7.744259390113584, + -8.286120816748381, + 8.083491160956697 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.4569105803966522, + 9.11885929107666, + 3.545238494873047, + 2.4567370414733887, + 0, + -0.3693843185901642, + 5.52318000793457, + 0, + 0, + 6.420943737030029, + 0, + 0.7011276483535767, + 0, + -0.3240821659564972, + 0, + 3.1852290630340576, + 0, + 4.174602508544922, + 3.7802627086639404, + 0, + 0, + 0, + 0, + 8.083491325378418 + ], + "type": "float32" + } + }, + { + "name": "hardSwish float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 0.7341583533045579, + 9.118859151005996, + 3.545238531520827, + 2.621943879280181, + -6.445507690595167, + -1.6835596550754381, + 5.523179785756591, + -5.958856051028132, + -9.169189933081544, + 6.420943542920213, + -3.293031330275471, + 1.0410166785810624, + -7.246322671816956, + -0.9472730969847909, + -5.778352255817807, + 3.185229125228698, + -7.261818072290236, + 4.174602615173795, + 3.7802628241590686, + -6.07124038718255, + -9.909919471919547, + -7.744259390113584, + -8.286120816748381, + 8.083491160956697 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.4569105803966522, + 9.11885929107666, + 3.545238494873047, + 2.4567370414733887, + 0, + -0.3693843185901642, + 5.52318000793457, + 0, + 0, + 6.420943737030029, + 0, + 0.7011276483535767, + 0, + -0.3240821659564972, + 0, + 3.1852290630340576, + 0, + 4.174602508544922, + 3.7802627086639404, + 0, + 0, + 0, + 0, + 8.083491325378418 + ], + "type": "float32" + } + }, + { + "name": "hardSwish float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 0.7341583533045579, + 9.118859151005996, + 3.545238531520827, + 2.621943879280181, + -6.445507690595167, + -1.6835596550754381, + 5.523179785756591, + -5.958856051028132, + -9.169189933081544, + 6.420943542920213, + -3.293031330275471, + 1.0410166785810624, + -7.246322671816956, + -0.9472730969847909, + -5.778352255817807, + 3.185229125228698, + -7.261818072290236, + 4.174602615173795, + 3.7802628241590686, + -6.07124038718255, + -9.909919471919547, + -7.744259390113584, + -8.286120816748381, + 8.083491160956697 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0.4569105803966522, + 9.11885929107666, + 3.545238494873047, + 2.4567370414733887, + 0, + -0.3693843185901642, + 5.52318000793457, + 0, + 0, + 6.420943737030029, + 0, + 0.7011276483535767, + 0, + -0.3240821659564972, + 0, + 3.1852290630340576, + 0, + 4.174602508544922, + 3.7802627086639404, + 0, + 0, + 0, + 0, + 8.083491325378418 + ], + "type": "float32" + } + }, + { + "name": "hardSwish float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7341583533045579, + 9.118859151005996, + 3.545238531520827, + 2.621943879280181, + -6.445507690595167, + -1.6835596550754381, + 5.523179785756591, + -5.958856051028132, + -9.169189933081544, + 6.420943542920213, + -3.293031330275471, + 1.0410166785810624, + -7.246322671816956, + -0.9472730969847909, + -5.778352255817807, + 3.185229125228698, + -7.261818072290236, + 4.174602615173795, + 3.7802628241590686, + -6.07124038718255, + -9.909919471919547, + -7.744259390113584, + -8.286120816748381, + 8.083491160956697 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.4569105803966522, + 9.11885929107666, + 3.545238494873047, + 2.4567370414733887, + 0, + -0.3693843185901642, + 5.52318000793457, + 0, + 0, + 6.420943737030029, + 0, + 0.7011276483535767, + 0, + -0.3240821659564972, + 0, + 3.1852290630340576, + 0, + 4.174602508544922, + 3.7802627086639404, + 0, + 0, + 0, + 0, + 8.083491325378418 + ], + "type": "float32" + } + }, + { + "name": "hardSwish float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.7341583533045579, + 9.118859151005996, + 3.545238531520827, + 2.621943879280181, + -6.445507690595167, + -1.6835596550754381, + 5.523179785756591, + -5.958856051028132, + -9.169189933081544, + 6.420943542920213, + -3.293031330275471, + 1.0410166785810624, + -7.246322671816956, + -0.9472730969847909, + -5.778352255817807, + 3.185229125228698, + -7.261818072290236, + 4.174602615173795, + 3.7802628241590686, + -6.07124038718255, + -9.909919471919547, + -7.744259390113584, + -8.286120816748381, + 8.083491160956697 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.4569105803966522, + 9.11885929107666, + 3.545238494873047, + 2.4567370414733887, + 0, + -0.3693843185901642, + 5.52318000793457, + 0, + 0, + 6.420943737030029, + 0, + 0.7011276483535767, + 0, + -0.3240821659564972, + 0, + 3.1852290630340576, + 0, + 4.174602508544922, + 3.7802627086639404, + 0, + 0, + 0, + 0, + 8.083491325378418 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/leaky_relu.json b/testing/web-platform/tests/webnn/resources/test_data/leaky_relu.json new file mode 100644 index 0000000000..a95a9a0cfc --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/leaky_relu.json @@ -0,0 +1,542 @@ +{ + "tests": [ + { + "name": "leakyRelu float32 1D tensor default options", // default options.alpha=0.01 + "inputs": { + "x": { + "shape": [24], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.19053640961647034, + 50.77590560913086, + -0.695496678352356, + -0.8057432770729065, + -0.9040110111236572, + 76.02884674072266, + 66.33873748779297, + -0.8410186767578125, + -0.1719101369380951, + -0.8747624158859253, + -0.0341646634042263, + -0.2277235984802246, + -0.02509489096701145, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -0.33178603649139404, + -0.4603901207447052, + -0.6147925853729248, + 64.26514434814453, + 21.469341278076172, + -0.31514689326286316, + -0.4127694368362427, + -0.6559529304504395 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.19053640961647034, + 50.77590560913086, + -0.695496678352356, + -0.8057432770729065, + -0.9040110111236572, + 76.02884674072266, + 66.33873748779297, + -0.8410186767578125, + -0.1719101369380951, + -0.8747624158859253, + -0.0341646634042263, + -0.2277235984802246, + -0.02509489096701145, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -0.33178603649139404, + -0.4603901207447052, + -0.6147925853729248, + 64.26514434814453, + 21.469341278076172, + -0.31514689326286316, + -0.4127694368362427, + -0.6559529304504395 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.19053640961647034, + 50.77590560913086, + -0.695496678352356, + -0.8057432770729065, + -0.9040110111236572, + 76.02884674072266, + 66.33873748779297, + -0.8410186767578125, + -0.1719101369380951, + -0.8747624158859253, + -0.0341646634042263, + -0.2277235984802246, + -0.02509489096701145, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -0.33178603649139404, + -0.4603901207447052, + -0.6147925853729248, + 64.26514434814453, + 21.469341278076172, + -0.31514689326286316, + -0.4127694368362427, + -0.6559529304504395 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 4D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + -0.19053640961647034, + 50.77590560913086, + -0.695496678352356, + -0.8057432770729065, + -0.9040110111236572, + 76.02884674072266, + 66.33873748779297, + -0.8410186767578125, + -0.1719101369380951, + -0.8747624158859253, + -0.0341646634042263, + -0.2277235984802246, + -0.02509489096701145, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -0.33178603649139404, + -0.4603901207447052, + -0.6147925853729248, + 64.26514434814453, + 21.469341278076172, + -0.31514689326286316, + -0.4127694368362427, + -0.6559529304504395 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 5D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + -0.19053640961647034, + 50.77590560913086, + -0.695496678352356, + -0.8057432770729065, + -0.9040110111236572, + 76.02884674072266, + 66.33873748779297, + -0.8410186767578125, + -0.1719101369380951, + -0.8747624158859253, + -0.0341646634042263, + -0.2277235984802246, + -0.02509489096701145, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -0.33178603649139404, + -0.4603901207447052, + -0.6147925853729248, + 64.26514434814453, + 21.469341278076172, + -0.31514689326286316, + -0.4127694368362427, + -0.6559529304504395 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 1D tensor negative options.alpha", + "inputs": { + "x": { + "shape": [24], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "options": { + "alpha": -97.70109193608776 + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1861.5615234375, + 50.77590560913086, + 6795.07861328125, + 7872.19970703125, + 8832.2861328125, + 76.02884674072266, + 66.33873748779297, + 8216.8447265625, + 1679.580810546875, + 8546.5244140625, + 333.7925109863281, + 2224.884521484375, + 245.17982482910156, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + 3241.5859375, + 4498.06201171875, + 6006.5908203125, + 64.26514434814453, + 21.469341278076172, + 3079.019775390625, + 4032.802490234375, + 6408.73193359375 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 2D tensor positive options.alpha", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "options": { + "alpha": 35.799162942273234 + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -682.1043701171875, + 50.77590560913086, + -2489.81982421875, + -2884.493408203125, + -3236.28369140625, + 76.02884674072266, + 66.33873748779297, + -3010.776611328125, + -615.4238891601562, + -3131.576416015625, + -122.306640625, + -815.2314453125, + -89.83760833740234, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + -1187.7662353515625, + -1648.158203125, + -2200.906005859375, + 64.26514434814453, + 21.469341278076172, + -1128.1995849609375, + -1477.6800537109375, + -2348.256591796875 + ], + "type": "float32" + } + }, + { + "name": "leakyRelu float32 5D tensor options.alpha=0.0", // relu + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + -19.053641157857015, + 50.77590443347373, + -69.54966768567536, + -80.57432185346957, + -90.40109641580112, + 76.02884674163622, + 66.33873525494391, + -84.10186452043264, + -17.19101282693427, + -87.47624329964907, + -3.4164664941905585, + -22.7723589638245, + -2.509489125727569, + 18.933284857582677, + 98.61402761165104, + 55.33923216295767, + -33.178605382176, + -46.03901297809681, + -61.47925538549912, + 64.26514742116822, + 21.46934200700099, + -31.51468946013378, + -41.27694294131783, + -65.59528852425132 + ], + "type": "float32" + } + }, + "options": { + "alpha": 0.0 + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + 0, + 50.77590560913086, + 0, + 0, + 0, + 76.02884674072266, + 66.33873748779297, + 0, + 0, + 0, + 0, + 0, + 0, + 18.933284759521484, + 98.61402893066406, + 55.3392333984375, + 0, + 0, + 0, + 64.26514434814453, + 21.469341278076172, + 0, + 0, + 0 + ], + "type": "float32" + }, + "type": "float32" + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/linear.json b/testing/web-platform/tests/webnn/resources/test_data/linear.json new file mode 100644 index 0000000000..ded1d2d7e3 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/linear.json @@ -0,0 +1,751 @@ +{ // linear: Calculate a linear function y = alpha * x + beta on the input tensor. + "tests": [ + { + "name": "linear float32 1D tensor default options", // default options: {alpha: 1, beta: 0} + "inputs": { + "x": { + "shape": [24], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -1.12251615524292, + -6.605223178863525, + -1.9555538892745972, + -4.598548412322998, + 4.234208106994629, + 3.0975420475006104, + 3.7465922832489014, + -4.487029552459717, + 6.407402038574219, + -4.354544162750244, + -5.819092750549316, + 3.7214345932006836, + -6.330113887786865, + 8.580595016479492, + -6.764922142028809, + 6.433565616607666, + -9.708685874938965, + 2.6431379318237305, + 5.2140889167785645, + 9.65861701965332, + -8.721749305725098, + -0.4533396363258362, + 9.992619514465332, + -6.469675064086914 + ], + "type": "float32" + } + }, + { + "name": "linear float32 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -1.12251615524292, + -6.605223178863525, + -1.9555538892745972, + -4.598548412322998, + 4.234208106994629, + 3.0975420475006104, + 3.7465922832489014, + -4.487029552459717, + 6.407402038574219, + -4.354544162750244, + -5.819092750549316, + 3.7214345932006836, + -6.330113887786865, + 8.580595016479492, + -6.764922142028809, + 6.433565616607666, + -9.708685874938965, + 2.6431379318237305, + 5.2140889167785645, + 9.65861701965332, + -8.721749305725098, + -0.4533396363258362, + 9.992619514465332, + -6.469675064086914 + ], + "type": "float32" + } + }, + { + "name": "linear float32 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -1.12251615524292, + -6.605223178863525, + -1.9555538892745972, + -4.598548412322998, + 4.234208106994629, + 3.0975420475006104, + 3.7465922832489014, + -4.487029552459717, + 6.407402038574219, + -4.354544162750244, + -5.819092750549316, + 3.7214345932006836, + -6.330113887786865, + 8.580595016479492, + -6.764922142028809, + 6.433565616607666, + -9.708685874938965, + 2.6431379318237305, + 5.2140889167785645, + 9.65861701965332, + -8.721749305725098, + -0.4533396363258362, + 9.992619514465332, + -6.469675064086914 + ], + "type": "float32" + } + }, + { + "name": "linear float32 4D tensor default options", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -1.12251615524292, + -6.605223178863525, + -1.9555538892745972, + -4.598548412322998, + 4.234208106994629, + 3.0975420475006104, + 3.7465922832489014, + -4.487029552459717, + 6.407402038574219, + -4.354544162750244, + -5.819092750549316, + 3.7214345932006836, + -6.330113887786865, + 8.580595016479492, + -6.764922142028809, + 6.433565616607666, + -9.708685874938965, + 2.6431379318237305, + 5.2140889167785645, + 9.65861701965332, + -8.721749305725098, + -0.4533396363258362, + 9.992619514465332, + -6.469675064086914 + ], + "type": "float32" + } + }, + { + "name": "linear float32 5D tensor default options", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -1.12251615524292, + -6.605223178863525, + -1.9555538892745972, + -4.598548412322998, + 4.234208106994629, + 3.0975420475006104, + 3.7465922832489014, + -4.487029552459717, + 6.407402038574219, + -4.354544162750244, + -5.819092750549316, + 3.7214345932006836, + -6.330113887786865, + 8.580595016479492, + -6.764922142028809, + 6.433565616607666, + -9.708685874938965, + 2.6431379318237305, + 5.2140889167785645, + 9.65861701965332, + -8.721749305725098, + -0.4533396363258362, + 9.992619514465332, + -6.469675064086914 + ], + "type": "float32" + } + }, + { + "name": "linear float32 4D tensor specified options.alpha and default options.beta", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1225161816883542, + -6.605223195131225, + -1.9555539248683687, + -4.598548331438281, + 4.234208072658522, + 3.097542121236385, + 3.7465923873418348, + -4.487029772637743, + 6.407402114982858, + -4.354544013606705, + -5.8190925441357955, + 3.7214346452179328, + -6.330114110872294, + 8.580595073862398, + -6.764922344398516, + 6.433565829855674, + -9.708685944356201, + 2.6431380232113746, + 5.214088864824586, + 9.658617012096975, + -8.72174939837989, + -0.4533396492565025, + 9.992619953447026, + -6.469674921617137 + ], + "type": "float32" + } + }, + "options": { + "alpha": 7.398793812746618 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -8.305265426635742, + -48.87068176269531, + -14.46873950958252, + -34.023712158203125, + 31.328031539916992, + 22.918073654174805, + 27.72026252746582, + -33.198604583740234, + 47.407047271728516, + -32.2183723449707, + -43.05426788330078, + 27.53412628173828, + -46.835205078125, + 63.486053466796875, + -50.05226516723633, + 47.600624084472656, + -71.83256530761719, + 19.556032180786133, + 38.57796859741211, + 71.46211242675781, + -64.53042602539062, + -3.3541665077209473, + 73.9333267211914, + -47.86779022216797 + ], + "type": "float32" + } + }, + { + "name": "linear float32 positive 4D tensor specified positive options.beta and default options.alpha", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 5.098545948694657, + 3.381463063963137, + 8.054763200467299, + 8.074773950900846, + 0.47079092139064027, + 5.243823847381135, + 3.8273059380736973, + 5.369768658136882, + 6.103317088913478, + 3.75057871122652, + 0.7479738402058334, + 1.8931976115227744, + 1.9056464154414843, + 7.8633162842491355, + 4.580754697122725, + 9.373635444757738, + 6.584214206038917, + 9.344809838863029, + 5.16057820830762, + 0.8060914255567009, + 9.13053330505177, + 3.193740457592318, + 5.748293601645558, + 4.113487804502045 + ], + "type": "float32" + } + }, + "options": { + "beta": 5.919095653700928 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 11.017641067504883, + 9.300558090209961, + 13.973857879638672, + 13.99386978149414, + 6.389886379241943, + 11.162919998168945, + 9.7464017868042, + 11.288864135742188, + 12.02241325378418, + 9.669673919677734, + 6.667069435119629, + 7.81229305267334, + 7.824741840362549, + 13.782411575317383, + 10.499850273132324, + 15.292730331420898, + 12.50330924987793, + 15.263904571533203, + 11.079673767089844, + 6.725186824798584, + 15.049629211425781, + 9.112835884094238, + 11.667388916015625, + 10.032583236694336 + ], + "type": "float32" + } + }, + { + "name": "linear float32 negative 4D tensor specified negative options.beta and default options.alpha", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -5.098545948694657, + -3.381463063963137, + -8.054763200467299, + -8.074773950900846, + -0.47079092139064027, + -5.243823847381135, + -3.8273059380736973, + -5.369768658136882, + -6.103317088913478, + -3.75057871122652, + -0.7479738402058334, + -1.8931976115227744, + -1.9056464154414843, + -7.8633162842491355, + -4.580754697122725, + -9.373635444757738, + -6.584214206038917, + -9.344809838863029, + -5.16057820830762, + -0.8060914255567009, + -9.13053330505177, + -3.193740457592318, + -5.748293601645558, + -4.113487804502045 + ], + "type": "float32" + } + }, + "options": { + "beta": -5.919095653700928 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -11.017641067504883, + -9.300558090209961, + -13.973857879638672, + -13.99386978149414, + -6.389886379241943, + -11.162919998168945, + -9.7464017868042, + -11.288864135742188, + -12.02241325378418, + -9.669673919677734, + -6.667069435119629, + -7.81229305267334, + -7.824741840362549, + -13.782411575317383, + -10.499850273132324, + -15.292730331420898, + -12.50330924987793, + -15.263904571533203, + -11.079673767089844, + -6.725186824798584, + -15.049629211425781, + -9.112835884094238, + -11.667388916015625, + -10.032583236694336 + ], + "type": "float32" + } + }, + { + "name": "linear float32 positive 4D tensor all options (positive options.alpha and positive options.beta)", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 5.098545948694657, + 3.381463063963137, + 8.054763200467299, + 8.074773950900846, + 0.47079092139064027, + 5.243823847381135, + 3.8273059380736973, + 5.369768658136882, + 6.103317088913478, + 3.75057871122652, + 0.7479738402058334, + 1.8931976115227744, + 1.9056464154414843, + 7.8633162842491355, + 4.580754697122725, + 9.373635444757738, + 6.584214206038917, + 9.344809838863029, + 5.16057820830762, + 0.8060914255567009, + 9.13053330505177, + 3.193740457592318, + 5.748293601645558, + 4.113487804502045 + ], + "type": "float32" + } + }, + "options": { + "alpha": 7.398793812746618, + "beta": 5.919095653700928 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 43.64218521118164, + 30.937843322753906, + 65.5146255493164, + 65.66268157958984, + 9.402379989624023, + 44.71706771850586, + 34.236541748046875, + 45.64890670776367, + 51.0762825012207, + 33.668853759765625, + 11.45319938659668, + 19.92647361755371, + 20.018579483032227, + 64.09815216064453, + 39.811153411865234, + 75.27268981933594, + 54.63433837890625, + 75.05941009521484, + 44.10115051269531, + 11.883199691772461, + 73.47402954101562, + 29.548921585083008, + 48.44953155517578, + 36.35394287109375 + ], + "type": "float32" + } + }, + { + "name": "linear float32 positive 4D tensor all options (negative options.alpha and negative options.beta)", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 5.098545948694657, + 3.381463063963137, + 8.054763200467299, + 8.074773950900846, + 0.47079092139064027, + 5.243823847381135, + 3.8273059380736973, + 5.369768658136882, + 6.103317088913478, + 3.75057871122652, + 0.7479738402058334, + 1.8931976115227744, + 1.9056464154414843, + 7.8633162842491355, + 4.580754697122725, + 9.373635444757738, + 6.584214206038917, + 9.344809838863029, + 5.16057820830762, + 0.8060914255567009, + 9.13053330505177, + 3.193740457592318, + 5.748293601645558, + 4.113487804502045 + ], + "type": "float32" + } + }, + "options": { + "alpha": -7.398793812746618, + "beta": -5.919095653700928 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -43.64218521118164, + -30.937843322753906, + -65.5146255493164, + -65.66268157958984, + -9.402379989624023, + -44.71706771850586, + -34.236541748046875, + -45.64890670776367, + -51.0762825012207, + -33.668853759765625, + -11.45319938659668, + -19.92647361755371, + -20.018579483032227, + -64.09815216064453, + -39.811153411865234, + -75.27268981933594, + -54.63433837890625, + -75.05941009521484, + -44.10115051269531, + -11.883199691772461, + -73.47402954101562, + -29.548921585083008, + -48.44953155517578, + -36.35394287109375 + ], + "type": "float32" + } + }, + { + "name": "linear float32 negative 4D tensor all options (positive options.alpha and negative options.beta)", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -5.098545948694657, + -3.381463063963137, + -8.054763200467299, + -8.074773950900846, + -0.47079092139064027, + -5.243823847381135, + -3.8273059380736973, + -5.369768658136882, + -6.103317088913478, + -3.75057871122652, + -0.7479738402058334, + -1.8931976115227744, + -1.9056464154414843, + -7.8633162842491355, + -4.580754697122725, + -9.373635444757738, + -6.584214206038917, + -9.344809838863029, + -5.16057820830762, + -0.8060914255567009, + -9.13053330505177, + -3.193740457592318, + -5.748293601645558, + -4.113487804502045 + ], + "type": "float32" + } + }, + "options": { + "alpha": 7.398793812746618, + "beta": -5.919095653700928 + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -43.64218521118164, + -30.937843322753906, + -65.5146255493164, + -65.66268157958984, + -9.402379989624023, + -44.71706771850586, + -34.236541748046875, + -45.64890670776367, + -51.0762825012207, + -33.668853759765625, + -11.45319938659668, + -19.92647361755371, + -20.018579483032227, + -64.09815216064453, + -39.811153411865234, + -75.27268981933594, + -54.63433837890625, + -75.05941009521484, + -44.10115051269531, + -11.883199691772461, + -73.47402954101562, + -29.548921585083008, + -48.44953155517578, + -36.35394287109375 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/log.json b/testing/web-platform/tests/webnn/resources/test_data/log.json new file mode 100644 index 0000000000..c48406e707 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/log.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "log float32 positive 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data":[ + 63.82541897073002, + 25.31772341801677, + 96.44790987312221, + 40.9185632583299, + 36.57906966041302, + 57.81629837118902, + 10.057244454482062, + 17.836828533595984, + 50.79246415149721, + 83.86059370830392, + 12.065509440949572, + 22.702478725761654, + 47.55981402665108, + 17.543881349985526, + 32.65243800095941, + 20.35301082726726, + 52.54472350026202, + 45.60880392588138, + 30.38581309524917, + 13.70955827062823, + 10.39676015729949, + 50.840946828645464, + 5.682034333775321, + 94.02275663421658 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 4.15615177154541, + 3.2315046787261963, + 4.569003105163574, + 3.7115838527679443, + 3.5994763374328613, + 4.057270526885986, + 2.308293104171753, + 2.88126540184021, + 3.927747964859009, + 4.4291558265686035, + 2.4903509616851807, + 3.122474193572998, + 3.861988067626953, + 2.8647050857543945, + 3.48591947555542, + 3.0132288932800293, + 3.9616646766662598, + 3.820100784301758, + 3.413975715637207, + 2.618093252182007, + 2.34149432182312, + 3.9287021160125732, + 1.7373093366622925, + 4.54353666305542 + ], + "type": "float32" + } + }, + { + "name": "log float32 positive 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data":[ + 63.82541897073002, + 25.31772341801677, + 96.44790987312221, + 40.9185632583299, + 36.57906966041302, + 57.81629837118902, + 10.057244454482062, + 17.836828533595984, + 50.79246415149721, + 83.86059370830392, + 12.065509440949572, + 22.702478725761654, + 47.55981402665108, + 17.543881349985526, + 32.65243800095941, + 20.35301082726726, + 52.54472350026202, + 45.60880392588138, + 30.38581309524917, + 13.70955827062823, + 10.39676015729949, + 50.840946828645464, + 5.682034333775321, + 94.02275663421658 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 4.15615177154541, + 3.2315046787261963, + 4.569003105163574, + 3.7115838527679443, + 3.5994763374328613, + 4.057270526885986, + 2.308293104171753, + 2.88126540184021, + 3.927747964859009, + 4.4291558265686035, + 2.4903509616851807, + 3.122474193572998, + 3.861988067626953, + 2.8647050857543945, + 3.48591947555542, + 3.0132288932800293, + 3.9616646766662598, + 3.820100784301758, + 3.413975715637207, + 2.618093252182007, + 2.34149432182312, + 3.9287021160125732, + 1.7373093366622925, + 4.54353666305542 + ], + "type": "float32" + } + }, + { + "name": "log float32 positive 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data":[ + 63.82541897073002, + 25.31772341801677, + 96.44790987312221, + 40.9185632583299, + 36.57906966041302, + 57.81629837118902, + 10.057244454482062, + 17.836828533595984, + 50.79246415149721, + 83.86059370830392, + 12.065509440949572, + 22.702478725761654, + 47.55981402665108, + 17.543881349985526, + 32.65243800095941, + 20.35301082726726, + 52.54472350026202, + 45.60880392588138, + 30.38581309524917, + 13.70955827062823, + 10.39676015729949, + 50.840946828645464, + 5.682034333775321, + 94.02275663421658 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 4.15615177154541, + 3.2315046787261963, + 4.569003105163574, + 3.7115838527679443, + 3.5994763374328613, + 4.057270526885986, + 2.308293104171753, + 2.88126540184021, + 3.927747964859009, + 4.4291558265686035, + 2.4903509616851807, + 3.122474193572998, + 3.861988067626953, + 2.8647050857543945, + 3.48591947555542, + 3.0132288932800293, + 3.9616646766662598, + 3.820100784301758, + 3.413975715637207, + 2.618093252182007, + 2.34149432182312, + 3.9287021160125732, + 1.7373093366622925, + 4.54353666305542 + ], + "type": "float32" + } + }, + { + "name": "log float32 positive 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data":[ + 63.82541897073002, + 25.31772341801677, + 96.44790987312221, + 40.9185632583299, + 36.57906966041302, + 57.81629837118902, + 10.057244454482062, + 17.836828533595984, + 50.79246415149721, + 83.86059370830392, + 12.065509440949572, + 22.702478725761654, + 47.55981402665108, + 17.543881349985526, + 32.65243800095941, + 20.35301082726726, + 52.54472350026202, + 45.60880392588138, + 30.38581309524917, + 13.70955827062823, + 10.39676015729949, + 50.840946828645464, + 5.682034333775321, + 94.02275663421658 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 4.15615177154541, + 3.2315046787261963, + 4.569003105163574, + 3.7115838527679443, + 3.5994763374328613, + 4.057270526885986, + 2.308293104171753, + 2.88126540184021, + 3.927747964859009, + 4.4291558265686035, + 2.4903509616851807, + 3.122474193572998, + 3.861988067626953, + 2.8647050857543945, + 3.48591947555542, + 3.0132288932800293, + 3.9616646766662598, + 3.820100784301758, + 3.413975715637207, + 2.618093252182007, + 2.34149432182312, + 3.9287021160125732, + 1.7373093366622925, + 4.54353666305542 + ], + "type": "float32" + } + }, + { + "name": "log float32 positive 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data":[ + 63.82541897073002, + 25.31772341801677, + 96.44790987312221, + 40.9185632583299, + 36.57906966041302, + 57.81629837118902, + 10.057244454482062, + 17.836828533595984, + 50.79246415149721, + 83.86059370830392, + 12.065509440949572, + 22.702478725761654, + 47.55981402665108, + 17.543881349985526, + 32.65243800095941, + 20.35301082726726, + 52.54472350026202, + 45.60880392588138, + 30.38581309524917, + 13.70955827062823, + 10.39676015729949, + 50.840946828645464, + 5.682034333775321, + 94.02275663421658 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 4.15615177154541, + 3.2315046787261963, + 4.569003105163574, + 3.7115838527679443, + 3.5994763374328613, + 4.057270526885986, + 2.308293104171753, + 2.88126540184021, + 3.927747964859009, + 4.4291558265686035, + 2.4903509616851807, + 3.122474193572998, + 3.861988067626953, + 2.8647050857543945, + 3.48591947555542, + 3.0132288932800293, + 3.9616646766662598, + 3.820100784301758, + 3.413975715637207, + 2.618093252182007, + 2.34149432182312, + 3.9287021160125732, + 1.7373093366622925, + 4.54353666305542 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/matmul.json b/testing/web-platform/tests/webnn/resources/test_data/matmul.json new file mode 100644 index 0000000000..6e0423a68d --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/matmul.json @@ -0,0 +1,1289 @@ +{ + "tests": [ + { + "name": "matmul float32 1D and 1D tensors all positive produces a scalar", + "inputs": { + "a": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7458.89013671875, + "type": "float32" + } + }, + { + "name": "matmul float32 1D and 1D tensors all negative produces a scalar", + "inputs": { + "a": { + "shape": [4], + "data": [ + -86.60583871803968, + -94.74202421330796, + -86.16720380573273, + -76.0215630990851 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + -21.22328469397374, + -56.66441199254357, + -77.66753889428908, + -56.55797454862353 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 18198.58203125, + "type": "float32" + } + }, + { + "name": "matmul float32 positive 1D and negative 1D tensors produces a scalar", + "inputs": { + "a": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + -21.22328469397374, + -56.66441199254357, + -77.66753889428908, + -56.55797454862353 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -7069.85546875, + "type": "float32" + } + }, + { + "name": "matmul float32 negative 1D and positive 1D tensors produces a scalar", + "inputs": { + "a": { + "shape": [4], + "data": [ + -86.60583871803968, + -94.74202421330796, + -86.16720380573273, + -76.0215630990851 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -19578.140625, + "type": "float32" + } + }, + { + "name": "matmul float32 1D and 2D tensors", + "inputs": { + "a": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 88.17004408170853, + 78.40126706348094, + 14.819002753540623, + 3.692303791736573, + 45.9064286713635, + 43.08391896733015, + 47.19946845924572, + 60.925216107016425, + 8.162760351602216, + 20.33326305093228, + 20.438397895943282, + 27.01940859922867, + 15.601424432184263, + 87.46969388883927, + 65.79554455585657, + 69.31696864490797, + 31.984439910782992, + 12.291812891860388, + 13.304834654547172, + 85.26705387930089 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 5], + "data": [ + 8602.796875, + 7075.7802734375, + 3083.654052734375, + 3881.228271484375, + 8131.462890625 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 1D and 4D tensors", + "inputs": { + "a": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 4, 2], + "data": [ + 71.54684436671175, + 78.61926127874348, + 2.246814764541316, + 12.044773359659434, + 1.8342867333124069, + 82.09732511549477, + 43.884761946067094, + 5.616231825100204, + 34.67424097413332, + 49.152710076333506, + 75.34904358690912, + 84.74523302920429, + 36.56497325521975, + 22.89479672718755, + 15.02636975800511, + 66.49530785246675, + 65.81345056776044, + 26.749681209347376, + 19.415639234175774, + 98.60692665127114, + 65.39448996549784, + 56.47023672202065, + 80.64523905250766, + 82.20401464839868, + 70.84606482516416, + 50.27994995977012, + 67.39406108056262, + 75.35806805146241, + 2.7487208784167327, + 68.0645872775828, + 70.73791158057968, + 46.26436742398676 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2], + "data": [ + 5293.36376953125, + 7255.7626953125, + 5224.80322265625, + 7556.21142578125, + 8926.5361328125, + 8476.359375, + 7713.62158203125, + 8234.0224609375 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 2D and 1D tensors", + "inputs": { + "a": { + "shape": [5, 4], + "data": [ + 88.17004408170853, + 43.08391896733015, + 20.438397895943282, + 69.31696864490797, + 78.40126706348094, + 47.19946845924572, + 27.01940859922867, + 31.984439910782992, + 14.819002753540623, + 60.925216107016425, + 15.601424432184263, + 12.291812891860388, + 3.692303791736573, + 8.162760351602216, + 87.46969388883927, + 13.304834654547172, + 45.9064286713635, + 20.33326305093228, + 65.79554455585657, + 85.26705387930089 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [5, 1], + "data": [ + 8602.796875, + 7075.7802734375, + 3083.654052734375, + 3881.228271484375, + 8131.462890625 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 2D and 2D tensors", + "inputs": { + "a": { + "shape": [3, 4], + "data": [ + 10.43066143431215, + 24.46751944495327, + 55.88757596028084, + 3.241082746029833, + 87.58891110272717, + 22.401545251921174, + 79.85144951531564, + 99.64449452911536, + 24.740541547653283, + 65.96242676599853, + 38.1360764688486, + 87.11140260507597 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 88.17004408170853, + 78.40126706348094, + 14.819002753540623, + 3.692303791736573, + 45.9064286713635, + 43.08391896733015, + 47.19946845924572, + 60.925216107016425, + 8.162760351602216, + 20.33326305093228, + 20.438397895943282, + 27.01940859922867, + 15.601424432184263, + 87.46969388883927, + 65.79554455585657, + 69.31696864490797, + 31.984439910782992, + 12.291812891860388, + 13.304834654547172, + 85.26705387930089 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [3, 5], + "data": [ + 3340.7431640625, + 3586.344482421875, + 2557.025634765625, + 5169.8271484375, + 4929.85009765625, + 17226.955078125, + 13269.03515625, + 5133.4072265625, + 8816.5986328125, + 18226.65234375, + 11841.033203125, + 8869.705078125, + 6051.1396484375, + 5124.5390625, + 12413.8984375 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 3D and 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 56.46701250066562, + 99.86045478237251, + 71.05493372292567, + 32.45438455331333, + 17.310747999630017, + 2.586275053048559, + 92.31499166302054, + 96.9758519231732, + 26.4721315276526, + 77.67031776320978, + 29.278788710989147, + 82.12142428847062, + 89.89308471484885, + 82.49795321217854, + 64.36866008901963, + 23.75928513568486, + 6.67026681065197, + 81.55583129445503, + 16.142963270263433, + 57.45134849716054, + 26.82641739603182, + 85.0296980735713, + 36.198863464757956, + 89.60960360138286 + ], + "type": "float32" + }, + "b": { + "shape": [2, 4, 5], + "data": [ + 70.38780515954635, + 25.489176068987597, + 28.25419591483602, + 84.51486608529449, + 58.87341530615436, + 46.252837428713555, + 24.897335441310766, + 44.09449366886899, + 51.865646783698985, + 1.123237180407144, + 4.187554708673558, + 71.24650172124491, + 16.0345266486708, + 23.677297120787454, + 61.277276711169094, + 65.15946418752658, + 58.392497125216906, + 70.12740970610143, + 9.119727538574839, + 24.17997835305117, + 84.42636665997716, + 78.55551451746716, + 38.482969428827076, + 80.65414903244603, + 57.15212267967695, + 46.10971199065528, + 28.41227860070996, + 90.9256677352717, + 94.66067935241847, + 61.772877196686295, + 60.324859158187635, + 70.97433442190315, + 10.631051143172332, + 55.616284948780525, + 35.0523090419651, + 22.128390497020668, + 38.19757703840079, + 78.17564687251797, + 62.57684276680773, + 88.35256743439288 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 5], + "data": [ + 11005.6748046875, + 10883.064453125, + 9414.0009765625, + 11929.9931640625, + 8575.3720703125, + 8043.556640625, + 12745.41015625, + 8884.0341796875, + 4667.3173828125, + 9023.7333984375, + 10929.3818359375, + 9489.8232421875, + 10401.216796875, + 7707.87744140625, + 5425.5654296875, + 15802.0888671875, + 14881.6220703125, + 13502.23828125, + 20126.2890625, + 14589.1806640625, + 6568.7900390625, + 6181.41162109375, + 12335.123046875, + 12751.05078125, + 11060.98046875, + 10352.16015625, + 10515.310546875, + 16153.86328125, + 17833.36328125, + 15971.80859375 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 3D and 3D (broadcast) tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 56.46701250066562, + 99.86045478237251, + 71.05493372292567, + 32.45438455331333, + 17.310747999630017, + 2.586275053048559, + 92.31499166302054, + 96.9758519231732, + 26.4721315276526, + 77.67031776320978, + 29.278788710989147, + 82.12142428847062, + 89.89308471484885, + 82.49795321217854, + 64.36866008901963, + 23.75928513568486, + 6.67026681065197, + 81.55583129445503, + 16.142963270263433, + 57.45134849716054, + 26.82641739603182, + 85.0296980735713, + 36.198863464757956, + 89.60960360138286 + ], + "type": "float32" + }, + "b": { + "shape": [1, 4, 1], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 1], + "data": [ + 15019.9462890625, + 11942.376953125, + 15035.0322265625, + 13553.013671875, + 12302.328125, + 16517.9765625 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 3D and 2D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 56.46701250066562, + 99.86045478237251, + 71.05493372292567, + 32.45438455331333, + 17.310747999630017, + 2.586275053048559, + 92.31499166302054, + 96.9758519231732, + 26.4721315276526, + 77.67031776320978, + 29.278788710989147, + 82.12142428847062, + 89.89308471484885, + 82.49795321217854, + 64.36866008901963, + 23.75928513568486, + 6.67026681065197, + 81.55583129445503, + 16.142963270263433, + 57.45134849716054, + 26.82641739603182, + 85.0296980735713, + 36.198863464757956, + 89.60960360138286 + ], + "type": "float32" + }, + "b": { + "shape": [4, 1], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 1], + "data": [ + 15019.9462890625, + 11942.376953125, + 15035.0322265625, + 13553.013671875, + 12302.328125, + 16517.9765625 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 3D and 1D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 56.46701250066562, + 99.86045478237251, + 71.05493372292567, + 32.45438455331333, + 17.310747999630017, + 2.586275053048559, + 92.31499166302054, + 96.9758519231732, + 26.4721315276526, + 77.67031776320978, + 29.278788710989147, + 82.12142428847062, + 89.89308471484885, + 82.49795321217854, + 64.36866008901963, + 23.75928513568486, + 6.67026681065197, + 81.55583129445503, + 16.142963270263433, + 57.45134849716054, + 26.82641739603182, + 85.0296980735713, + 36.198863464757956, + 89.60960360138286 + ], + "type": "float32" + }, + "b": { + "shape": [4], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 1], + "data": [ + 15019.9462890625, + 11942.376953125, + 15035.0322265625, + 13553.013671875, + 12302.328125, + 16517.9765625 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 4D and 4D (broadcast) tensors", + "inputs": { + "a": { + "shape": [2, 2, 3, 4], + "data": [ + 33.759571073537195, + 97.24552988493511, + 83.70851840974835, + 64.53984433339888, + 29.579379819004714, + 17.1992392523348, + 67.94749248305698, + 97.45838011362066, + 54.44928258357935, + 29.552200144620187, + 51.99970332220345, + 36.031014589568585, + 9.701058359869318, + 27.048420991685028, + 6.020919350370768, + 22.94090320010824, + 53.12438840861784, + 15.292234456978937, + 48.21302721807221, + 87.40800039569459, + 51.344420382168174, + 21.15575571555004, + 27.58948746939598, + 58.41238372971891, + 5.963276160098108, + 84.74937985741033, + 55.457381638128126, + 50.858698377713, + 23.76357555039641, + 62.330927022798434, + 35.77495779930495, + 17.340241762611043, + 29.16901397355762, + 23.19136101699426, + 27.060928414739994, + 1.2828527630654118, + 8.720425533325615, + 48.4528113654477, + 99.01303756634434, + 65.86412386674365, + 92.69683028841827, + 85.43540981621389, + 37.49127872314042, + 51.39713319355885, + 53.19015180051876, + 38.33119168879018, + 75.20586450347592, + 3.853793976963038 + ], + "type": "float32" + }, + "b": { + "shape": [1, 1, 4, 5], + "data": [ + 88.17004408170853, + 78.40126706348094, + 14.819002753540623, + 3.692303791736573, + 45.9064286713635, + 43.08391896733015, + 47.19946845924572, + 60.925216107016425, + 8.162760351602216, + 20.33326305093228, + 20.438397895943282, + 27.01940859922867, + 15.601424432184263, + 87.46969388883927, + 65.79554455585657, + 69.31696864490797, + 31.984439910782992, + 12.291812891860388, + 13.304834654547172, + 85.26705387930089 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 3, 5], + "data": [ + 13350.8759765625, + 11562.755859375, + 8524.271484375, + 9099.0927734375, + 14537.8701171875, + 11493.283203125, + 8083.90869140625, + 3744.22216796875, + 7489.62353515625, + 14488.2314453125, + 9634.3720703125, + 8221.173828125, + 3861.51416015625, + 5470.0556640625, + 9594.072265625, + 3733.946533203125, + 2933.679931640625, + 2167.611083984375, + 1088.48193359375, + 3347.576416015625, + 12387.083984375, + 8985.1884765625, + 3545.52783203125, + 5701.10595703125, + 13374.9169921875, + 10051.3671875, + 7637.7470703125, + 3198.221435546875, + 3552.6796875, + 9583.1220703125, + 8835.94921875, + 7592.7666015625, + 6742.10400390625, + 6241.31396484375, + 9982.404296875, + 6713.85205078125, + 6326.3173828125, + 4920.9609375, + 3956.46875, + 6190.67626953125, + 4213.013671875, + 4153.708984375, + 2283.152099609375, + 2681.085693359375, + 3700.47509765625, + 9445.5869140625, + 7752.5400390625, + 5435.56005859375, + 9964.6591796875, + 13516.18359375, + 16182.931640625, + 13956.9560546875, + 7795.52685546875, + 5002.8349609375, + 12841.802734375, + 8145.45654296875, + 8134.66650390625, + 4344.25, + 7138.79052734375, + 8497.98046875 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 4D and 3D tensors", + "inputs": { + "a": { + "shape": [2, 2, 3, 4], + "data": [ + 33.759571073537195, + 97.24552988493511, + 83.70851840974835, + 64.53984433339888, + 29.579379819004714, + 17.1992392523348, + 67.94749248305698, + 97.45838011362066, + 54.44928258357935, + 29.552200144620187, + 51.99970332220345, + 36.031014589568585, + 9.701058359869318, + 27.048420991685028, + 6.020919350370768, + 22.94090320010824, + 53.12438840861784, + 15.292234456978937, + 48.21302721807221, + 87.40800039569459, + 51.344420382168174, + 21.15575571555004, + 27.58948746939598, + 58.41238372971891, + 5.963276160098108, + 84.74937985741033, + 55.457381638128126, + 50.858698377713, + 23.76357555039641, + 62.330927022798434, + 35.77495779930495, + 17.340241762611043, + 29.16901397355762, + 23.19136101699426, + 27.060928414739994, + 1.2828527630654118, + 8.720425533325615, + 48.4528113654477, + 99.01303756634434, + 65.86412386674365, + 92.69683028841827, + 85.43540981621389, + 37.49127872314042, + 51.39713319355885, + 53.19015180051876, + 38.33119168879018, + 75.20586450347592, + 3.853793976963038 + ], + "type": "float32" + }, + "b": { + "shape": [2, 4, 5], + "data": [ + 70.38780515954635, + 25.489176068987597, + 28.25419591483602, + 84.51486608529449, + 58.87341530615436, + 46.252837428713555, + 24.897335441310766, + 44.09449366886899, + 51.865646783698985, + 1.123237180407144, + 4.187554708673558, + 71.24650172124491, + 16.0345266486708, + 23.677297120787454, + 61.277276711169094, + 65.15946418752658, + 58.392497125216906, + 70.12740970610143, + 9.119727538574839, + 24.17997835305117, + 84.42636665997716, + 78.55551451746716, + 38.482969428827076, + 80.65414903244603, + 57.15212267967695, + 46.10971199065528, + 28.41227860070996, + 90.9256677352717, + 94.66067935241847, + 61.772877196686295, + 60.324859158187635, + 70.97433442190315, + 10.631051143172332, + 55.616284948780525, + 35.0523090419651, + 22.128390497020668, + 38.19757703840079, + 78.17564687251797, + 62.57684276680773, + 88.35256743439288 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 3, 5], + "data": [ + 11430.05859375, + 13014.2392578125, + 11110.080078125, + 10467.46484375, + 8786.7724609375, + 9512.4111328125, + 11714.0283203125, + 9518.1435546875, + 5889.55419921875, + 8280.9365234375, + 7764.95166015625, + 7932.3759765625, + 6202.0625, + 7694.32373046875, + 7296.4384765625, + 2937.076416015625, + 2834.196533203125, + 4690.14990234375, + 5113.283203125, + 4463.22998046875, + 10032.8623046875, + 11368.3623046875, + 10780.572265625, + 13883.421875, + 13393.5166015625, + 8267.212890625, + 8823.828125, + 8759.2177734375, + 11333.4462890625, + 10369.25390625, + 7885.7978515625, + 9182.943359375, + 8361.2900390625, + 6676.46533203125, + 5074.3115234375, + 5835.33837890625, + 5718.96875, + 5209.5322265625, + 6246.40185546875, + 4080.533935546875, + 3322.71826171875, + 3323.802490234375, + 2370.630615234375, + 4320.47900390625, + 3432.568115234375, + 10400.7939453125, + 11604.9267578125, + 10942.7744140625, + 14918.220703125, + 12781.3603515625, + 15164.451171875, + 14333.4267578125, + 15752.0966796875, + 20865.154296875, + 16430.63671875, + 10880.1533203125, + 10752.34765625, + 6632.99462890625, + 12342.2919921875, + 8384.3896484375 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 5D and 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 3, 4], + "data": [ + 33.759571073537195, + 97.24552988493511, + 83.70851840974835, + 64.53984433339888, + 29.579379819004714, + 17.1992392523348, + 67.94749248305698, + 97.45838011362066, + 54.44928258357935, + 29.552200144620187, + 51.99970332220345, + 36.031014589568585, + 9.701058359869318, + 27.048420991685028, + 6.020919350370768, + 22.94090320010824, + 53.12438840861784, + 15.292234456978937, + 48.21302721807221, + 87.40800039569459, + 51.344420382168174, + 21.15575571555004, + 27.58948746939598, + 58.41238372971891, + 5.963276160098108, + 84.74937985741033, + 55.457381638128126, + 50.858698377713, + 23.76357555039641, + 62.330927022798434, + 35.77495779930495, + 17.340241762611043, + 29.16901397355762, + 23.19136101699426, + 27.060928414739994, + 1.2828527630654118, + 8.720425533325615, + 48.4528113654477, + 99.01303756634434, + 65.86412386674365, + 92.69683028841827, + 85.43540981621389, + 37.49127872314042, + 51.39713319355885, + 53.19015180051876, + 38.33119168879018, + 75.20586450347592, + 3.853793976963038 + ], + "type": "float32" + }, + "b": { + "shape": [1, 1, 1, 4, 5], + "data": [ + 88.17004408170853, + 78.40126706348094, + 14.819002753540623, + 3.692303791736573, + 45.9064286713635, + 43.08391896733015, + 47.19946845924572, + 60.925216107016425, + 8.162760351602216, + 20.33326305093228, + 20.438397895943282, + 27.01940859922867, + 15.601424432184263, + 87.46969388883927, + 65.79554455585657, + 69.31696864490797, + 31.984439910782992, + 12.291812891860388, + 13.304834654547172, + 85.26705387930089 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 3, 5], + "data": [ + 13350.8759765625, + 11562.755859375, + 8524.271484375, + 9099.0927734375, + 14537.8701171875, + 11493.283203125, + 8083.90869140625, + 3744.22216796875, + 7489.62353515625, + 14488.2314453125, + 9634.3720703125, + 8221.173828125, + 3861.51416015625, + 5470.0556640625, + 9594.072265625, + 3733.946533203125, + 2933.679931640625, + 2167.611083984375, + 1088.48193359375, + 3347.576416015625, + 12387.083984375, + 8985.1884765625, + 3545.52783203125, + 5701.10595703125, + 13374.9169921875, + 10051.3671875, + 7637.7470703125, + 3198.221435546875, + 3552.6796875, + 9583.1220703125, + 8835.94921875, + 7592.7666015625, + 6742.10400390625, + 6241.31396484375, + 9982.404296875, + 6713.85205078125, + 6326.3173828125, + 4920.9609375, + 3956.46875, + 6190.67626953125, + 4213.013671875, + 4153.708984375, + 2283.152099609375, + 2681.085693359375, + 3700.47509765625, + 9445.5869140625, + 7752.5400390625, + 5435.56005859375, + 9964.6591796875, + 13516.18359375, + 16182.931640625, + 13956.9560546875, + 7795.52685546875, + 5002.8349609375, + 12841.802734375, + 8145.45654296875, + 8134.66650390625, + 4344.25, + 7138.79052734375, + 8497.98046875 + ], + "type": "float32" + } + }, + { + "name": "matmul float32 5D and 2D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 3, 4], + "data": [ + 33.759571073537195, + 97.24552988493511, + 83.70851840974835, + 64.53984433339888, + 29.579379819004714, + 17.1992392523348, + 67.94749248305698, + 97.45838011362066, + 54.44928258357935, + 29.552200144620187, + 51.99970332220345, + 36.031014589568585, + 9.701058359869318, + 27.048420991685028, + 6.020919350370768, + 22.94090320010824, + 53.12438840861784, + 15.292234456978937, + 48.21302721807221, + 87.40800039569459, + 51.344420382168174, + 21.15575571555004, + 27.58948746939598, + 58.41238372971891, + 5.963276160098108, + 84.74937985741033, + 55.457381638128126, + 50.858698377713, + 23.76357555039641, + 62.330927022798434, + 35.77495779930495, + 17.340241762611043, + 29.16901397355762, + 23.19136101699426, + 27.060928414739994, + 1.2828527630654118, + 8.720425533325615, + 48.4528113654477, + 99.01303756634434, + 65.86412386674365, + 92.69683028841827, + 85.43540981621389, + 37.49127872314042, + 51.39713319355885, + 53.19015180051876, + 38.33119168879018, + 75.20586450347592, + 3.853793976963038 + ], + "type": "float32" + }, + "b": { + "shape": [4, 5], + "data": [ + 88.17004408170853, + 78.40126706348094, + 14.819002753540623, + 3.692303791736573, + 45.9064286713635, + 43.08391896733015, + 47.19946845924572, + 60.925216107016425, + 8.162760351602216, + 20.33326305093228, + 20.438397895943282, + 27.01940859922867, + 15.601424432184263, + 87.46969388883927, + 65.79554455585657, + 69.31696864490797, + 31.984439910782992, + 12.291812891860388, + 13.304834654547172, + 85.26705387930089 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 3, 5], + "data": [ + 13350.8759765625, + 11562.755859375, + 8524.271484375, + 9099.0927734375, + 14537.8701171875, + 11493.283203125, + 8083.90869140625, + 3744.22216796875, + 7489.62353515625, + 14488.2314453125, + 9634.3720703125, + 8221.173828125, + 3861.51416015625, + 5470.0556640625, + 9594.072265625, + 3733.946533203125, + 2933.679931640625, + 2167.611083984375, + 1088.48193359375, + 3347.576416015625, + 12387.083984375, + 8985.1884765625, + 3545.52783203125, + 5701.10595703125, + 13374.9169921875, + 10051.3671875, + 7637.7470703125, + 3198.221435546875, + 3552.6796875, + 9583.1220703125, + 8835.94921875, + 7592.7666015625, + 6742.10400390625, + 6241.31396484375, + 9982.404296875, + 6713.85205078125, + 6326.3173828125, + 4920.9609375, + 3956.46875, + 6190.67626953125, + 4213.013671875, + 4153.708984375, + 2283.152099609375, + 2681.085693359375, + 3700.47509765625, + 9445.5869140625, + 7752.5400390625, + 5435.56005859375, + 9964.6591796875, + 13516.18359375, + 16182.931640625, + 13956.9560546875, + 7795.52685546875, + 5002.8349609375, + 12841.802734375, + 8145.45654296875, + 8134.66650390625, + 4344.25, + 7138.79052734375, + 8497.98046875 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/max.json b/testing/web-platform/tests/webnn/resources/test_data/max.json new file mode 100644 index 0000000000..27a258248f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/max.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "max float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -34.504351374665106, + 85.7347144113418, + 25.81801706847253, + -91.37040900746763, + 87.01370408789617, + 0.17744044937266779, + 74.88266681438157, + -4.169913633773888, + -73.76497938350255, + 55.38879910920386, + -58.69169647961585, + -67.62333258102981, + -89.83530842960631, + -8.275739745367574, + 97.5957755490123, + -48.96886862489005, + 95.34497928951401, + -97.36359789785926, + -59.90717913787087, + 97.15334887926792, + -40.226924090258805, + -61.51427015643396, + 33.36324314194775, + 12.693191672027254 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + 17.72909164428711, + 88.1480712890625, + 25.818017959594727, + 11.817361831665039, + 87.01370239257812, + 0.17744044959545135, + 74.8826675415039, + -4.1699137687683105, + 50.57254409790039, + 55.388797760009766, + 50.21434020996094, + 20.59501075744629, + -60.699546813964844, + -8.275739669799805, + 97.59577178955078, + -48.968868255615234, + 95.34497833251953, + 21.347652435302734, + 79.85667419433594, + 97.15335083007812, + 1.2300019264221191, + 65.67964935302734, + 99.89971160888672, + 12.693191528320312 + ], + "type": "float32" + } + }, + { + "name": "max float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -34.504351374665106, + 85.7347144113418, + 25.81801706847253, + -91.37040900746763, + 87.01370408789617, + 0.17744044937266779, + 74.88266681438157, + -4.169913633773888, + -73.76497938350255, + 55.38879910920386, + -58.69169647961585, + -67.62333258102981, + -89.83530842960631, + -8.275739745367574, + 97.5957755490123, + -48.96886862489005, + 95.34497928951401, + -97.36359789785926, + -59.90717913787087, + 97.15334887926792, + -40.226924090258805, + -61.51427015643396, + 33.36324314194775, + 12.693191672027254 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + 17.72909164428711, + 88.1480712890625, + 25.818017959594727, + 11.817361831665039, + 87.01370239257812, + 0.17744044959545135, + 74.8826675415039, + -4.1699137687683105, + 50.57254409790039, + 55.388797760009766, + 50.21434020996094, + 20.59501075744629, + -60.699546813964844, + -8.275739669799805, + 97.59577178955078, + -48.968868255615234, + 95.34497833251953, + 21.347652435302734, + 79.85667419433594, + 97.15335083007812, + 1.2300019264221191, + 65.67964935302734, + 99.89971160888672, + 12.693191528320312 + ], + "type": "float32" + } + }, + { + "name": "max float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -34.504351374665106, + 85.7347144113418, + 25.81801706847253, + -91.37040900746763, + 87.01370408789617, + 0.17744044937266779, + 74.88266681438157, + -4.169913633773888, + -73.76497938350255, + 55.38879910920386, + -58.69169647961585, + -67.62333258102981, + -89.83530842960631, + -8.275739745367574, + 97.5957755490123, + -48.96886862489005, + 95.34497928951401, + -97.36359789785926, + -59.90717913787087, + 97.15334887926792, + -40.226924090258805, + -61.51427015643396, + 33.36324314194775, + 12.693191672027254 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + 17.72909164428711, + 88.1480712890625, + 25.818017959594727, + 11.817361831665039, + 87.01370239257812, + 0.17744044959545135, + 74.8826675415039, + -4.1699137687683105, + 50.57254409790039, + 55.388797760009766, + 50.21434020996094, + 20.59501075744629, + -60.699546813964844, + -8.275739669799805, + 97.59577178955078, + -48.968868255615234, + 95.34497833251953, + 21.347652435302734, + 79.85667419433594, + 97.15335083007812, + 1.2300019264221191, + 65.67964935302734, + 99.89971160888672, + 12.693191528320312 + ], + "type": "float32" + } + }, + { + "name": "max float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -34.504351374665106, + 85.7347144113418, + 25.81801706847253, + -91.37040900746763, + 87.01370408789617, + 0.17744044937266779, + 74.88266681438157, + -4.169913633773888, + -73.76497938350255, + 55.38879910920386, + -58.69169647961585, + -67.62333258102981, + -89.83530842960631, + -8.275739745367574, + 97.5957755490123, + -48.96886862489005, + 95.34497928951401, + -97.36359789785926, + -59.90717913787087, + 97.15334887926792, + -40.226924090258805, + -61.51427015643396, + 33.36324314194775, + 12.693191672027254 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 17.72909164428711, + 88.1480712890625, + 25.818017959594727, + 11.817361831665039, + 87.01370239257812, + 0.17744044959545135, + 74.8826675415039, + -4.1699137687683105, + 50.57254409790039, + 55.388797760009766, + 50.21434020996094, + 20.59501075744629, + -60.699546813964844, + -8.275739669799805, + 97.59577178955078, + -48.968868255615234, + 95.34497833251953, + 21.347652435302734, + 79.85667419433594, + 97.15335083007812, + 1.2300019264221191, + 65.67964935302734, + 99.89971160888672, + 12.693191528320312 + ], + "type": "float32" + } + }, + { + "name": "max float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -34.504351374665106, + 85.7347144113418, + 25.81801706847253, + -91.37040900746763, + 87.01370408789617, + 0.17744044937266779, + 74.88266681438157, + -4.169913633773888, + -73.76497938350255, + 55.38879910920386, + -58.69169647961585, + -67.62333258102981, + -89.83530842960631, + -8.275739745367574, + 97.5957755490123, + -48.96886862489005, + 95.34497928951401, + -97.36359789785926, + -59.90717913787087, + 97.15334887926792, + -40.226924090258805, + -61.51427015643396, + 33.36324314194775, + 12.693191672027254 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + 17.72909164428711, + 88.1480712890625, + 25.818017959594727, + 11.817361831665039, + 87.01370239257812, + 0.17744044959545135, + 74.8826675415039, + -4.1699137687683105, + 50.57254409790039, + 55.388797760009766, + 50.21434020996094, + 20.59501075744629, + -60.699546813964844, + -8.275739669799805, + 97.59577178955078, + -48.968868255615234, + 95.34497833251953, + 21.347652435302734, + 79.85667419433594, + 97.15335083007812, + 1.2300019264221191, + 65.67964935302734, + 99.89971160888672, + 12.693191528320312 + ], + "type": "float32" + } + }, + { + "name": "max float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 48.261154377933934 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 48.26115417480469, + 88.1480712890625, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 50.771915435791016, + 48.26115417480469, + 50.57254409790039, + 48.26115417480469, + 50.21434020996094, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 57.25886917114258, + 48.26115417480469, + 73.71659851074219, + 48.26115417480469, + 79.85667419433594, + 48.26115417480469, + 48.26115417480469, + 65.67964935302734, + 99.89971160888672, + 48.26115417480469 + ], + "type": "float32" + } + }, + { + "name": "max float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + 49.523128811715225, + -61.55576225687129, + -6.564808468730291, + 93.32226979251419, + 3.3104185798987515, + -98.31839935789897 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 49.523128509521484, + 88.1480712890625, + -6.564808368682861, + 93.32227325439453, + 19.51302146911621, + -62.87843704223633, + 50.771915435791016, + -56.91352081298828, + 50.57254409790039, + 93.32227325439453, + 50.21434020996094, + 20.59501075744629, + 49.523128509521484, + -61.555763244628906, + 57.25886917114258, + 93.32227325439453, + 73.71659851074219, + 21.347652435302734, + 79.85667419433594, + -22.918458938598633, + 1.2300019264221191, + 93.32227325439453, + 99.89971160888672, + -62.321685791015625 + ], + "type": "float32" + } + }, + { + "name": "max float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 39.32178507655172, + 44.523740611524744, + 58.046287381834105, + 84.13702482473266 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 39.32178497314453, + 88.1480712890625, + 39.32178497314453, + 44.523738861083984, + 44.523738861083984, + 44.523738861083984, + 58.046287536621094, + 58.046287536621094, + 58.046287536621094, + 84.13702392578125, + 84.13702392578125, + 84.13702392578125, + 39.32178497314453, + 39.32178497314453, + 57.25886917114258, + 44.523738861083984, + 73.71659851074219, + 44.523738861083984, + 79.85667419433594, + 58.046287536621094, + 58.046287536621094, + 84.13702392578125, + 99.89971160888672, + 84.13702392578125 + ], + "type": "float32" + } + }, + { + "name": "max float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 48.261154377933934 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 17.729091355190548, + 88.14807331138127, + -12.79482748560001, + 11.817361453415515, + 19.513022179766494, + -62.87843656259127, + 50.77191512294212, + -56.91352259821851, + 50.572543533605796, + -96.00484496901664, + 50.21433885008736, + 20.59501102482639, + -60.69954854047626, + -96.84203452345174, + 57.258868129331574, + -56.29146148481858, + 73.7165958518618, + 21.347652653042374, + 79.85667318536576, + -22.91845979108436, + 1.2300019204149066, + 65.67965067534072, + 99.89971317042682, + -62.321684141101045 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 48.26115417480469, + 88.1480712890625, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 50.771915435791016, + 48.26115417480469, + 50.57254409790039, + 48.26115417480469, + 50.21434020996094, + 48.26115417480469, + 48.26115417480469, + 48.26115417480469, + 57.25886917114258, + 48.26115417480469, + 73.71659851074219, + 48.26115417480469, + 79.85667419433594, + 48.26115417480469, + 48.26115417480469, + 65.67964935302734, + 99.89971160888672, + 48.26115417480469 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/max_pool2d.json b/testing/web-platform/tests/webnn/resources/test_data/max_pool2d.json new file mode 100644 index 0000000000..cf426620e5 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/max_pool2d.json @@ -0,0 +1,1368 @@ +{ + "tests": [ + { + "name": "maxPool2d float32 4D tensor default options", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 99.28312683105469, + 81.73119354248047 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.windowDimensions", + "inputs":{ + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 99.28312683105469, + 99.28312683105469, + 66.09259033203125, + 99.28312683105469, + 99.28312683105469, + 72.1085205078125, + 97.90348052978516, + 72.1085205078125, + 72.1085205078125, + 81.73119354248047, + 72.44898986816406, + 72.44898986816406, + 81.73119354248047, + 72.8883056640625, + 72.44898986816406, + 80.30484008789062, + 72.8883056640625, + 72.33577728271484 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.padding", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "padding": [1, 0, 0, 1] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 99.28312683105469, + 99.28312683105469, + 99.28312683105469, + 99.28312683105469, + 81.73119354248047, + 72.8883056640625, + 81.73119354248047, + 72.8883056640625 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.strides", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 99.28312683105469, + 66.09259033203125, + 97.90348052978516, + 72.1085205078125, + 81.73119354248047, + 72.44898986816406, + 80.30484008789062, + 72.33577728271484 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.dilations", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "dilations": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 89.00830078125, + 72.33577728271484 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.autoPad=explicit", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "padding": [1, 0, 0, 1], + "autoPad": "explicit" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 99.28312683105469, + 99.28312683105469, + 99.28312683105469, + 99.28312683105469, + 81.73119354248047, + 72.8883056640625, + 81.73119354248047, + 72.8883056640625 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.autoPad=same-upper", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 90.19580379109371, + 3.100482753598527, + 25.328822520960074, + 95.79016799138552, + -28.66704447898583, + -95.44752500898142, + -4.985161962403197, + -8.48460109616957, + -80.97691341362152, + -17.005109111308727, + -6.038760193142295, + 38.40922446364979, + -7.992178512477196, + 81.2006267730795, + 20.61885063772428, + -33.95224998477518, + -96.69404524982971, + -80.66036026545542, + 14.05812623156973, + 71.19384576769727, + 90.27735528668126, + -98.09758264975711, + 79.82735855507025, + 51.29492635990994, + 97.67522462775861, + -28.093948900517333, + 6.811551163368804, + 62.81929061329504, + -74.77656671772914, + 81.95471994368236, + 79.12276218750796, + -79.67557686936195 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 90.19580078125, + 95.79016876220703, + 81.20063018798828, + 38.40922546386719, + 97.67522430419922, + 79.82736206054688, + 97.67522430419922, + 79.12276458740234 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.autoPad=same-lower", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 90.19580379109371, + 3.100482753598527, + 25.328822520960074, + 95.79016799138552, + -28.66704447898583, + -95.44752500898142, + -4.985161962403197, + -8.48460109616957, + -80.97691341362152, + -17.005109111308727, + -6.038760193142295, + 38.40922446364979, + -7.992178512477196, + 81.2006267730795, + 20.61885063772428, + -33.95224998477518, + -96.69404524982971, + -80.66036026545542, + 14.05812623156973, + 71.19384576769727, + 90.27735528668126, + -98.09758264975711, + 79.82735855507025, + 51.29492635990994, + 97.67522462775861, + -28.093948900517333, + 6.811551163368804, + 62.81929061329504, + -74.77656671772914, + 81.95471994368236, + 79.12276218750796, + -79.67557686936195 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 90.19580078125, + 95.79016876220703, + 81.20063018798828, + 81.20063018798828, + 90.27735900878906, + 79.82736206054688, + 97.67522430419922, + 81.95471954345703 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.autoPad=same-upper ignores options.padding", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 90.19580379109371, + 3.100482753598527, + 25.328822520960074, + 95.79016799138552, + -28.66704447898583, + -95.44752500898142, + -4.985161962403197, + -8.48460109616957, + -80.97691341362152, + -17.005109111308727, + -6.038760193142295, + 38.40922446364979, + -7.992178512477196, + 81.2006267730795, + 20.61885063772428, + -33.95224998477518, + -96.69404524982971, + -80.66036026545542, + 14.05812623156973, + 71.19384576769727, + 90.27735528668126, + -98.09758264975711, + 79.82735855507025, + 51.29492635990994, + 97.67522462775861, + -28.093948900517333, + 6.811551163368804, + 62.81929061329504, + -74.77656671772914, + 81.95471994368236, + 79.12276218750796, + -79.67557686936195 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [2, 2, 2, 2], + "strides": [2, 2], + "autoPad": "same-upper" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 90.19580078125, + 95.79016876220703, + 81.20063018798828, + 38.40922546386719, + 97.67522430419922, + 79.82736206054688, + 97.67522430419922, + 79.12276458740234 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.autoPad=same-lower ignores options.padding", + "inputs": { + "input": { + "shape": [1, 2, 4, 4], + "data": [ + 90.19580379109371, + 3.100482753598527, + 25.328822520960074, + 95.79016799138552, + -28.66704447898583, + -95.44752500898142, + -4.985161962403197, + -8.48460109616957, + -80.97691341362152, + -17.005109111308727, + -6.038760193142295, + 38.40922446364979, + -7.992178512477196, + 81.2006267730795, + 20.61885063772428, + -33.95224998477518, + -96.69404524982971, + -80.66036026545542, + 14.05812623156973, + 71.19384576769727, + 90.27735528668126, + -98.09758264975711, + 79.82735855507025, + 51.29492635990994, + 97.67522462775861, + -28.093948900517333, + 6.811551163368804, + 62.81929061329504, + -74.77656671772914, + 81.95471994368236, + 79.12276218750796, + -79.67557686936195 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [2, 2, 2, 2], + "strides": [2, 2], + "autoPad": "same-lower" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 90.19580078125, + 95.79016876220703, + 81.20063018798828, + 81.20063018798828, + 90.27735900878906, + 79.82736206054688, + 97.67522430419922, + 81.95471954345703 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.layout=nchw", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "layout": "nchw" + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 99.28312683105469, + 81.73119354248047 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.layout=nhwc", + "inputs": { + "input": { + "shape": [1, 5, 5, 2], + "data": [ + 89.00830216793153, + -76.72171237621149, + -45.720390400208274, + 50.21706410294061, + -61.3061304134967, + -52.89547724835329, + -4.014514560596496, + -44.64233565670091, + -94.54893342858352, + -97.86752535352848, + 46.28090328619564, + 81.73119248706783, + 99.28312923953135, + 5.428491238061412, + -10.057873368956962, + -29.227728678237995, + 9.742474583994337, + 72.44899280781078, + -39.03501766575275, + -59.34124718116585, + 75.08192382950091, + 39.19959912145927, + 12.819415189421207, + -65.99438957588619, + -33.01505690327188, + -4.204323589500888, + 38.691340789603316, + -60.5458643662661, + 66.09259104681504, + 55.89052583821697, + 97.903480409299, + 80.30483906634527, + -8.737769993284147, + 72.88830243502153, + -53.4216238072017, + -46.59610987974246, + 72.10852084777076, + 20.503878887964206, + -40.42309116918719, + -31.126462826158445, + -35.68864442661396, + -57.29456052682171, + -87.64779401381033, + -26.62357805164706, + 38.87424286093716, + 15.93575469730375, + 39.38360329656629, + -78.77953474824318, + 7.429088108317444, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 2], + "data": [ + 99.28312683105469, + 81.73119354248047 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.roundingType=floor", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "floor" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 99.28312683105469, + 9.742474555969238, + 99.28312683105469, + 72.1085205078125, + 81.73119354248047, + 72.44898986816406, + 81.73119354248047, + 72.44898986816406 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.roundingType=ceil", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "ceil" + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 99.28312683105469, + 9.742474555969238, + -39.03501892089844, + 99.28312683105469, + 72.1085205078125, + 66.09259033203125, + 97.90348052978516, + 72.1085205078125, + 7.429088115692139, + 81.73119354248047, + 72.44898986816406, + -59.34124755859375, + 81.73119354248047, + 72.44898986816406, + 55.890525817871094, + 80.30484008789062, + 72.33577728271484, + 72.33577728271484 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "floor", + "outputSizes": [3, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 3], + "data": [ + 99.28312683105469, + 9.742474555969238, + -39.03501892089844, + 99.28312683105469, + 72.1085205078125, + 66.09259033203125, + 97.90348052978516, + 72.1085205078125, + 7.429088115692139, + 81.73119354248047, + 72.44898986816406, + -59.34124755859375, + 81.73119354248047, + 72.44898986816406, + 55.890525817871094, + 80.30484008789062, + 72.33577728271484, + 72.33577728271484 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil", + "inputs": { + "input": { + "shape": [1, 2, 5, 5], + "data": [ + 89.00830216793153, + -45.720390400208274, + -61.3061304134967, + -4.014514560596496, + -94.54893342858352, + 46.28090328619564, + 99.28312923953135, + -10.057873368956962, + 9.742474583994337, + -39.03501766575275, + 75.08192382950091, + 12.819415189421207, + -33.01505690327188, + 38.691340789603316, + 66.09259104681504, + 97.903480409299, + -8.737769993284147, + -53.4216238072017, + 72.10852084777076, + -40.42309116918719, + -35.68864442661396, + -87.64779401381033, + 38.87424286093716, + 39.38360329656629, + 7.429088108317444, + -76.72171237621149, + 50.21706410294061, + -52.89547724835329, + -44.64233565670091, + -97.86752535352848, + 81.73119248706783, + 5.428491238061412, + -29.227728678237995, + 72.44899280781078, + -59.34124718116585, + 39.19959912145927, + -65.99438957588619, + -4.204323589500888, + -60.5458643662661, + 55.89052583821697, + 80.30483906634527, + 72.88830243502153, + -46.59610987974246, + 20.503878887964206, + -31.126462826158445, + -57.29456052682171, + -26.62357805164706, + 15.93575469730375, + -78.77953474824318, + 72.33577555559427 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "roundingType": "ceil", + "outputSizes": [2, 2] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 99.28312683105469, + 9.742474555969238, + 99.28312683105469, + 72.1085205078125, + 81.73119354248047, + 72.44898986816406, + 81.73119354248047, + 72.44898986816406 + ], + "type": "float32" + } + }, + { + "name": "maxPool2d float32 4D tensor options.dilations with options.strides", + "inputs": { + "input": { + "shape": [1, 7, 7, 2], + "data": [ + 34.69258129387845, + -24.706248375920524, + -60.42807114468629, + 35.93883484387953, + 60.896094267313345, + 79.42220031805164, + -77.85906306951374, + 54.18820945858141, + -21.57693529351286, + -49.103906741859404, + 78.55176346486067, + 74.28213308844582, + -87.92769416001408, + 79.82047109868057, + 11.680922626564922, + -12.1545053403525, + -22.332939699432202, + 33.08486279636597, + 8.640676946303174, + 47.04064404360258, + 95.78234680258441, + -88.01998403139729, + -98.53630176965567, + 16.15897660557981, + 21.396089910647248, + 95.13234999362083, + -40.80724330720389, + -88.70921764059032, + -40.772770487731826, + 67.89843024034857, + -50.337466344983504, + -96.56610664792846, + 12.508098405268967, + -6.63581156175988, + -44.80198313101762, + 80.27474506768564, + -65.68411481136147, + -14.884790604208746, + -66.54857566488332, + 20.07233794529273, + -27.954270006840204, + -56.62217270552601, + 82.74794838911092, + 93.30175304845017, + -34.07339352229894, + -22.871643145139146, + 73.25525716488457, + 41.14021562026471, + -19.755147411323023, + 80.07700931110838, + -69.89277244982563, + 14.013250274581338, + -61.36640253626604, + 51.53046561516868, + 43.538863140698226, + -89.5888690731458, + 51.45121768091764, + 73.92397095355011, + -80.25264684029128, + 94.72747432067723, + 95.25411370348488, + 58.12575321550594, + 19.885722826536778, + -70.030129951855, + 63.41951918063978, + -54.11785116480967, + -97.2280762988258, + -60.65826309587585, + -31.049980820398645, + -14.64655330832754, + -63.73688919275588, + 47.34630581820389, + 85.5640530081308, + -53.38925321464192, + -70.84739324778467, + 47.35504709117748, + 83.38397624574233, + 7.36169510433227, + 46.85823546522715, + 98.13465616102368, + -43.93968566738362, + 50.33780282391024, + 37.455634062049, + -54.52760852219014, + -6.212307719031031, + 34.41734148282714, + 11.816772365254153, + 72.44517799372989, + 86.34609553228327, + 4.146569170394486, + 88.33040249135547, + 98.29994529007328, + -66.72379613555366, + 58.06434425465281, + -51.168278021154954, + -17.768582927864657, + 9.961172472871425, + -52.738431655100946 + ], + "type": "float32" + } + }, + "options": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "autoPad": "explicit", + "strides": [2, 2], + "dilations": [1, 1], + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [1, 3, 3, 2], + "data": [ + 60.896095275878906, + 79.42220306396484, + 95.7823486328125, + 79.42220306396484, + 78.55176544189453, + 95.1323471069336, + 82.7479476928711, + 93.30175018310547, + 95.7823486328125, + 80.27474212646484, + 43.53886413574219, + 95.1323471069336, + 95.25411224365234, + 94.72747802734375, + 95.25411224365234, + 98.13465881347656, + 63.419517517089844, + 98.13465881347656 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/min.json b/testing/web-platform/tests/webnn/resources/test_data/min.json new file mode 100644 index 0000000000..f5ea4779f4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/min.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "min float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -40.10139268078632, + 86.25190598846055, + 51.28017397936523, + -57.64906164772099, + -97.56107437073234, + -28.88173031289574, + 80.49570909929332, + 46.665406947365625, + 62.8068578280876, + 49.815340723067976, + -76.5204323768335, + 84.59909684299188, + 50.472812621661944, + -18.017285676776623, + 5.198459215825707, + -47.82608331903404, + 46.4500784043023, + -71.25122869019421, + -69.8506659654443, + 40.676491548922655, + -18.700123336900987, + 20.14988118692149, + 41.950685196569594, + 23.482911517986963 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + -40.10139083862305, + -38.2254524230957, + 51.280174255371094, + -57.64906311035156, + -97.56107330322266, + -28.881731033325195, + -76.01380920410156, + -69.59134674072266, + 53.60376739501953, + -39.096099853515625, + -76.52043151855469, + -40.39130401611328, + 50.47281265258789, + -18.01728630065918, + 5.198459148406982, + -47.82608413696289, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -40.10139268078632, + 86.25190598846055, + 51.28017397936523, + -57.64906164772099, + -97.56107437073234, + -28.88173031289574, + 80.49570909929332, + 46.665406947365625, + 62.8068578280876, + 49.815340723067976, + -76.5204323768335, + 84.59909684299188, + 50.472812621661944, + -18.017285676776623, + 5.198459215825707, + -47.82608331903404, + 46.4500784043023, + -71.25122869019421, + -69.8506659654443, + 40.676491548922655, + -18.700123336900987, + 20.14988118692149, + 41.950685196569594, + 23.482911517986963 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + -40.10139083862305, + -38.2254524230957, + 51.280174255371094, + -57.64906311035156, + -97.56107330322266, + -28.881731033325195, + -76.01380920410156, + -69.59134674072266, + 53.60376739501953, + -39.096099853515625, + -76.52043151855469, + -40.39130401611328, + 50.47281265258789, + -18.01728630065918, + 5.198459148406982, + -47.82608413696289, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -40.10139268078632, + 86.25190598846055, + 51.28017397936523, + -57.64906164772099, + -97.56107437073234, + -28.88173031289574, + 80.49570909929332, + 46.665406947365625, + 62.8068578280876, + 49.815340723067976, + -76.5204323768335, + 84.59909684299188, + 50.472812621661944, + -18.017285676776623, + 5.198459215825707, + -47.82608331903404, + 46.4500784043023, + -71.25122869019421, + -69.8506659654443, + 40.676491548922655, + -18.700123336900987, + 20.14988118692149, + 41.950685196569594, + 23.482911517986963 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + -40.10139083862305, + -38.2254524230957, + 51.280174255371094, + -57.64906311035156, + -97.56107330322266, + -28.881731033325195, + -76.01380920410156, + -69.59134674072266, + 53.60376739501953, + -39.096099853515625, + -76.52043151855469, + -40.39130401611328, + 50.47281265258789, + -18.01728630065918, + 5.198459148406982, + -47.82608413696289, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -40.10139268078632, + 86.25190598846055, + 51.28017397936523, + -57.64906164772099, + -97.56107437073234, + -28.88173031289574, + 80.49570909929332, + 46.665406947365625, + 62.8068578280876, + 49.815340723067976, + -76.5204323768335, + 84.59909684299188, + 50.472812621661944, + -18.017285676776623, + 5.198459215825707, + -47.82608331903404, + 46.4500784043023, + -71.25122869019421, + -69.8506659654443, + 40.676491548922655, + -18.700123336900987, + 20.14988118692149, + 41.950685196569594, + 23.482911517986963 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -40.10139083862305, + -38.2254524230957, + 51.280174255371094, + -57.64906311035156, + -97.56107330322266, + -28.881731033325195, + -76.01380920410156, + -69.59134674072266, + 53.60376739501953, + -39.096099853515625, + -76.52043151855469, + -40.39130401611328, + 50.47281265258789, + -18.01728630065918, + 5.198459148406982, + -47.82608413696289, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -40.10139268078632, + 86.25190598846055, + 51.28017397936523, + -57.64906164772099, + -97.56107437073234, + -28.88173031289574, + 80.49570909929332, + 46.665406947365625, + 62.8068578280876, + 49.815340723067976, + -76.5204323768335, + 84.59909684299188, + 50.472812621661944, + -18.017285676776623, + 5.198459215825707, + -47.82608331903404, + 46.4500784043023, + -71.25122869019421, + -69.8506659654443, + 40.676491548922655, + -18.700123336900987, + 20.14988118692149, + 41.950685196569594, + 23.482911517986963 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + -40.10139083862305, + -38.2254524230957, + 51.280174255371094, + -57.64906311035156, + -97.56107330322266, + -28.881731033325195, + -76.01380920410156, + -69.59134674072266, + 53.60376739501953, + -39.096099853515625, + -76.52043151855469, + -40.39130401611328, + 50.47281265258789, + -18.01728630065918, + 5.198459148406982, + -47.82608413696289, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 34.42634415560107 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -36.06953048706055, + -38.2254524230957, + 34.42634582519531, + -16.610267639160156, + 34.42634582519531, + -17.77212905883789, + -76.01380920410156, + -69.59134674072266, + 34.42634582519531, + -39.096099853515625, + 34.42634582519531, + -40.39130401611328, + 34.42634582519531, + 0.03283197432756424, + 34.42634582519531, + -17.720787048339844, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -19.072667739078668, + -78.27516046519088, + -13.43624418749556, + -93.01346559564098, + -72.27899383005467, + 63.141107125830274 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -36.06953048706055, + -78.27516174316406, + -13.436244010925293, + -93.01346588134766, + -72.27899169921875, + -17.77212905883789, + -76.01380920410156, + -78.27516174316406, + -13.436244010925293, + -93.01346588134766, + -72.27899169921875, + -40.39130401611328, + -19.072668075561523, + -78.27516174316406, + -13.436244010925293, + -93.01346588134766, + -72.27899169921875, + -82.3099365234375, + -80.47379302978516, + -78.27516174316406, + -73.2723617553711, + -93.01346588134766, + -72.27899169921875, + 4.945605278015137 + ], + "type": "float32" + } + }, + { + "name": "min float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 23.231731176710824, + 84.62673735224791, + -83.33529487921453, + -22.824559006255328 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -36.06953048706055, + -38.2254524230957, + 23.231731414794922, + -16.610267639160156, + 65.99324798583984, + -17.77212905883789, + -83.33529663085938, + -83.33529663085938, + -83.33529663085938, + -39.096099853515625, + -22.82455825805664, + -40.39130401611328, + 23.231731414794922, + 0.03283197432756424, + 23.231731414794922, + -17.720787048339844, + 17.383201599121094, + -82.3099365234375, + -83.33529663085938, + -83.33529663085938, + -83.33529663085938, + -33.74562072753906, + -22.82455825805664, + -22.82455825805664 + ], + "type": "float32" + } + }, + { + "name": "min float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 34.42634415560107 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -36.069532266228244, + -38.22545078196744, + 62.07444236586957, + -16.61026674714678, + 65.99324808387394, + -17.772129967582686, + -76.01381209267042, + -69.59134776850009, + 53.60376804727625, + -39.096100673437164, + 96.94400927938446, + -40.391302324618295, + 74.14437371697878, + 0.032831973556398, + 38.79835449778915, + -17.720786393721696, + 17.383201301159886, + -82.30993955305293, + -80.47379030810471, + -31.38984799993598, + -73.27236113112741, + -33.7456195461658, + -21.701524895337613, + 4.945605121041879 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -36.06953048706055, + -38.2254524230957, + 34.42634582519531, + -16.610267639160156, + 34.42634582519531, + -17.77212905883789, + -76.01380920410156, + -69.59134674072266, + 34.42634582519531, + -39.096099853515625, + 34.42634582519531, + -40.39130401611328, + 34.42634582519531, + 0.03283197432756424, + 34.42634582519531, + -17.720787048339844, + 17.383201599121094, + -82.3099365234375, + -80.47379302978516, + -31.389848709106445, + -73.2723617553711, + -33.74562072753906, + -21.70152473449707, + 4.945605278015137 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/mul.json b/testing/web-platform/tests/webnn/resources/test_data/mul.json new file mode 100644 index 0000000000..e6487cfc59 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/mul.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "mul float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + 74.96137241031886, + -34.53953260336324, + -33.316162844150114, + 53.92023954353448, + -83.69075015721262, + 19.78522024290173, + 36.2811360289287, + -34.31147605027482, + 49.10429164239241, + -54.538850393716665, + 70.77384875070422, + -55.18768187759977, + -93.96233815307488, + 60.0829826673602, + -92.73415188611666, + 87.60998747867865, + -8.881865647983787, + 71.79511481665139, + -26.158620254037416, + -18.935444705499236, + 34.64671570053736, + -60.95826678087097, + -11.11965362061676, + 77.50324337143496 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + 3681.4443359375, + -411.278076171875, + 703.4972534179688, + 3814.802978515625, + 7910.138671875, + -1855.63720703125, + 405.582763671875, + 1125.6197509765625, + 4091.3193359375, + -4969.61962890625, + -7.951977252960205, + -849.7775268554688, + 1264.6595458984375, + -3041.78955078125, + 2891.103759765625, + -579.6376342773438, + -192.98143005371094, + 1581.7545166015625, + 2197.89208984375, + 1781.2109375, + 2037.47900390625, + 3844.01513671875, + -36.79807662963867, + 766.0423583984375 + ], + "type": "float32" + } + }, + { + "name": "mul float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + 74.96137241031886, + -34.53953260336324, + -33.316162844150114, + 53.92023954353448, + -83.69075015721262, + 19.78522024290173, + 36.2811360289287, + -34.31147605027482, + 49.10429164239241, + -54.538850393716665, + 70.77384875070422, + -55.18768187759977, + -93.96233815307488, + 60.0829826673602, + -92.73415188611666, + 87.60998747867865, + -8.881865647983787, + 71.79511481665139, + -26.158620254037416, + -18.935444705499236, + 34.64671570053736, + -60.95826678087097, + -11.11965362061676, + 77.50324337143496 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + 3681.4443359375, + -411.278076171875, + 703.4972534179688, + 3814.802978515625, + 7910.138671875, + -1855.63720703125, + 405.582763671875, + 1125.6197509765625, + 4091.3193359375, + -4969.61962890625, + -7.951977252960205, + -849.7775268554688, + 1264.6595458984375, + -3041.78955078125, + 2891.103759765625, + -579.6376342773438, + -192.98143005371094, + 1581.7545166015625, + 2197.89208984375, + 1781.2109375, + 2037.47900390625, + 3844.01513671875, + -36.79807662963867, + 766.0423583984375 + ], + "type": "float32" + } + }, + { + "name": "mul float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + 74.96137241031886, + -34.53953260336324, + -33.316162844150114, + 53.92023954353448, + -83.69075015721262, + 19.78522024290173, + 36.2811360289287, + -34.31147605027482, + 49.10429164239241, + -54.538850393716665, + 70.77384875070422, + -55.18768187759977, + -93.96233815307488, + 60.0829826673602, + -92.73415188611666, + 87.60998747867865, + -8.881865647983787, + 71.79511481665139, + -26.158620254037416, + -18.935444705499236, + 34.64671570053736, + -60.95826678087097, + -11.11965362061676, + 77.50324337143496 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + 3681.4443359375, + -411.278076171875, + 703.4972534179688, + 3814.802978515625, + 7910.138671875, + -1855.63720703125, + 405.582763671875, + 1125.6197509765625, + 4091.3193359375, + -4969.61962890625, + -7.951977252960205, + -849.7775268554688, + 1264.6595458984375, + -3041.78955078125, + 2891.103759765625, + -579.6376342773438, + -192.98143005371094, + 1581.7545166015625, + 2197.89208984375, + 1781.2109375, + 2037.47900390625, + 3844.01513671875, + -36.79807662963867, + 766.0423583984375 + ], + "type": "float32" + } + }, + { + "name": "mul float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 74.96137241031886, + -34.53953260336324, + -33.316162844150114, + 53.92023954353448, + -83.69075015721262, + 19.78522024290173, + 36.2811360289287, + -34.31147605027482, + 49.10429164239241, + -54.538850393716665, + 70.77384875070422, + -55.18768187759977, + -93.96233815307488, + 60.0829826673602, + -92.73415188611666, + 87.60998747867865, + -8.881865647983787, + 71.79511481665139, + -26.158620254037416, + -18.935444705499236, + 34.64671570053736, + -60.95826678087097, + -11.11965362061676, + 77.50324337143496 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 3681.4443359375, + -411.278076171875, + 703.4972534179688, + 3814.802978515625, + 7910.138671875, + -1855.63720703125, + 405.582763671875, + 1125.6197509765625, + 4091.3193359375, + -4969.61962890625, + -7.951977252960205, + -849.7775268554688, + 1264.6595458984375, + -3041.78955078125, + 2891.103759765625, + -579.6376342773438, + -192.98143005371094, + 1581.7545166015625, + 2197.89208984375, + 1781.2109375, + 2037.47900390625, + 3844.01513671875, + -36.79807662963867, + 766.0423583984375 + ], + "type": "float32" + } + }, + { + "name": "mul float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 74.96137241031886, + -34.53953260336324, + -33.316162844150114, + 53.92023954353448, + -83.69075015721262, + 19.78522024290173, + 36.2811360289287, + -34.31147605027482, + 49.10429164239241, + -54.538850393716665, + 70.77384875070422, + -55.18768187759977, + -93.96233815307488, + 60.0829826673602, + -92.73415188611666, + 87.60998747867865, + -8.881865647983787, + 71.79511481665139, + -26.158620254037416, + -18.935444705499236, + 34.64671570053736, + -60.95826678087097, + -11.11965362061676, + 77.50324337143496 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + 3681.4443359375, + -411.278076171875, + 703.4972534179688, + 3814.802978515625, + 7910.138671875, + -1855.63720703125, + 405.582763671875, + 1125.6197509765625, + 4091.3193359375, + -4969.61962890625, + -7.951977252960205, + -849.7775268554688, + 1264.6595458984375, + -3041.78955078125, + 2891.103759765625, + -579.6376342773438, + -192.98143005371094, + 1581.7545166015625, + 2197.89208984375, + 1781.2109375, + 2037.47900390625, + 3844.01513671875, + -36.79807662963867, + 766.0423583984375 + ], + "type": "float32" + } + }, + { + "name": "mul float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 67.50372094970106 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 3315.18994140625, + 803.7978515625, + -1425.394775390625, + 4775.82080078125, + -6380.20068359375, + -6331.1103515625, + 754.6165771484375, + -2214.52197265625, + 5624.34130859375, + 6150.98828125, + -7.5845537185668945, + 1039.4193115234375, + -908.5472412109375, + -3417.4755859375, + -2104.513427734375, + -446.6123352050781, + 1466.6925048828125, + 1487.208740234375, + -5671.7783203125, + -6349.91064453125, + 3969.7099609375, + -4256.77001953125, + 223.388916015625, + 667.20703125 + ], + "type": "float32" + } + }, + { + "name": "mul float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -97.2933957218157, + -81.70872307646576, + -63.85933809294562, + -25.192203473799253, + 94.61556753087658, + -20.3817901013323 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -4778.197265625, + -972.9432983398438, + 1348.440673828125, + -1782.3232421875, + -8942.7119140625, + 1911.5888671875, + -1087.6319580078125, + 2680.5302734375, + -5320.69482421875, + -2295.531982421875, + -10.630775451660156, + -313.8379211425781, + 1309.492919921875, + 4136.625, + 1990.89501953125, + 166.67449951171875, + 2055.767333984375, + -449.04156494140625, + 8174.7578125, + 7686.14013671875, + -3755.3935546875, + 1588.6148681640625, + 313.10968017578125, + -201.4536895751953 + ], + "type": "float32" + } + }, + { + "name": "mul float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 8.696772886979204, + 48.377688521793914, + 97.75158873035582, + 62.215746875745594 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 427.1091003417969, + 103.55646514892578, + -183.63926696777344, + 3422.673095703125, + -4572.4794921875, + -4537.2978515625, + 1092.7540283203125, + -3206.8310546875, + 8144.5625, + 5669.14404296875, + -6.990409851074219, + 957.995361328125, + -117.05175018310547, + -440.2869567871094, + -271.1328125, + -320.07232666015625, + 1051.130126953125, + 1065.8333740234375, + -8213.255859375, + -9195.2529296875, + 5748.50439453125, + -3923.3115234375, + 205.88949584960938, + 614.940673828125 + ], + "type": "float32" + } + }, + { + "name": "mul float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 67.50372094970106 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 49.11121736270019, + 11.907459336794048, + -21.11579579294029, + 70.74900132517587, + -94.51628388361728, + -93.78905645837338, + 11.178888261493995, + -32.80592265135466, + 83.31897732883382, + 91.12072661737204, + -0.11235756222869497, + 15.397956296694915, + -13.45921729974026, + -50.62647440827837, + -31.176256208308388, + -6.616114020780813, + 21.727578749239072, + 22.03150842852844, + -84.02170952786258, + -94.06756015115154, + 58.807274013013654, + -63.0597856263404, + 3.3092826784791214, + 9.88400353323415 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 3315.18994140625, + 803.7978515625, + -1425.394775390625, + 4775.82080078125, + -6380.20068359375, + -6331.1103515625, + 754.6165771484375, + -2214.52197265625, + 5624.34130859375, + 6150.98828125, + -7.5845537185668945, + 1039.4193115234375, + -908.5472412109375, + -3417.4755859375, + -2104.513427734375, + -446.6123352050781, + 1466.6925048828125, + 1487.208740234375, + -5671.7783203125, + -6349.91064453125, + 3969.7099609375, + -4256.77001953125, + 223.388916015625, + 667.20703125 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/neg.json b/testing/web-platform/tests/webnn/resources/test_data/neg.json new file mode 100644 index 0000000000..8a1eea34f9 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/neg.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "neg float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + -58.334503020192145, + 94.230451435346, + -67.69306915096101, + -36.06663941646238, + 17.11511438752673, + 59.26063208864457, + -43.77507923449166, + -14.875581781743236, + 22.508566808333796, + 98.67680207393127, + 2.3155421451545237, + -89.86896422605746, + -14.288547289891255, + 16.222452140079383, + -4.68841786135998, + -44.46965063391528, + -52.13925804400618, + 24.165389381806392, + -66.45778331338028, + -11.172323888318175, + -25.024961990153656, + 22.26478329228287, + 35.29130058751991, + -86.18817022134313 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 58.334503173828125, + -94.23045349121094, + 67.69306945800781, + 36.0666389465332, + -17.115114212036133, + -59.2606315612793, + 43.77507781982422, + 14.875581741333008, + -22.50856590270996, + -98.67680358886719, + -2.315542221069336, + 89.86896514892578, + 14.28854751586914, + -16.22245216369629, + 4.688417911529541, + 44.46965026855469, + 52.139259338378906, + -24.165390014648438, + 66.4577865600586, + 11.172324180603027, + 25.024961471557617, + -22.26478385925293, + -35.29130172729492, + 86.18817138671875 + ], + "type": "float32" + } + }, + { + "name": "neg float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -58.334503020192145, + 94.230451435346, + -67.69306915096101, + -36.06663941646238, + 17.11511438752673, + 59.26063208864457, + -43.77507923449166, + -14.875581781743236, + 22.508566808333796, + 98.67680207393127, + 2.3155421451545237, + -89.86896422605746, + -14.288547289891255, + 16.222452140079383, + -4.68841786135998, + -44.46965063391528, + -52.13925804400618, + 24.165389381806392, + -66.45778331338028, + -11.172323888318175, + -25.024961990153656, + 22.26478329228287, + 35.29130058751991, + -86.18817022134313 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 58.334503173828125, + -94.23045349121094, + 67.69306945800781, + 36.0666389465332, + -17.115114212036133, + -59.2606315612793, + 43.77507781982422, + 14.875581741333008, + -22.50856590270996, + -98.67680358886719, + -2.315542221069336, + 89.86896514892578, + 14.28854751586914, + -16.22245216369629, + 4.688417911529541, + 44.46965026855469, + 52.139259338378906, + -24.165390014648438, + 66.4577865600586, + 11.172324180603027, + 25.024961471557617, + -22.26478385925293, + -35.29130172729492, + 86.18817138671875 + ], + "type": "float32" + } + }, + { + "name": "neg float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -58.334503020192145, + 94.230451435346, + -67.69306915096101, + -36.06663941646238, + 17.11511438752673, + 59.26063208864457, + -43.77507923449166, + -14.875581781743236, + 22.508566808333796, + 98.67680207393127, + 2.3155421451545237, + -89.86896422605746, + -14.288547289891255, + 16.222452140079383, + -4.68841786135998, + -44.46965063391528, + -52.13925804400618, + 24.165389381806392, + -66.45778331338028, + -11.172323888318175, + -25.024961990153656, + 22.26478329228287, + 35.29130058751991, + -86.18817022134313 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 58.334503173828125, + -94.23045349121094, + 67.69306945800781, + 36.0666389465332, + -17.115114212036133, + -59.2606315612793, + 43.77507781982422, + 14.875581741333008, + -22.50856590270996, + -98.67680358886719, + -2.315542221069336, + 89.86896514892578, + 14.28854751586914, + -16.22245216369629, + 4.688417911529541, + 44.46965026855469, + 52.139259338378906, + -24.165390014648438, + 66.4577865600586, + 11.172324180603027, + 25.024961471557617, + -22.26478385925293, + -35.29130172729492, + 86.18817138671875 + ], + "type": "float32" + } + }, + { + "name": "neg float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -58.334503020192145, + 94.230451435346, + -67.69306915096101, + -36.06663941646238, + 17.11511438752673, + 59.26063208864457, + -43.77507923449166, + -14.875581781743236, + 22.508566808333796, + 98.67680207393127, + 2.3155421451545237, + -89.86896422605746, + -14.288547289891255, + 16.222452140079383, + -4.68841786135998, + -44.46965063391528, + -52.13925804400618, + 24.165389381806392, + -66.45778331338028, + -11.172323888318175, + -25.024961990153656, + 22.26478329228287, + 35.29130058751991, + -86.18817022134313 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 58.334503173828125, + -94.23045349121094, + 67.69306945800781, + 36.0666389465332, + -17.115114212036133, + -59.2606315612793, + 43.77507781982422, + 14.875581741333008, + -22.50856590270996, + -98.67680358886719, + -2.315542221069336, + 89.86896514892578, + 14.28854751586914, + -16.22245216369629, + 4.688417911529541, + 44.46965026855469, + 52.139259338378906, + -24.165390014648438, + 66.4577865600586, + 11.172324180603027, + 25.024961471557617, + -22.26478385925293, + -35.29130172729492, + 86.18817138671875 + ], + "type": "float32" + } + }, + { + "name": "neg float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -58.334503020192145, + 94.230451435346, + -67.69306915096101, + -36.06663941646238, + 17.11511438752673, + 59.26063208864457, + -43.77507923449166, + -14.875581781743236, + 22.508566808333796, + 98.67680207393127, + 2.3155421451545237, + -89.86896422605746, + -14.288547289891255, + 16.222452140079383, + -4.68841786135998, + -44.46965063391528, + -52.13925804400618, + 24.165389381806392, + -66.45778331338028, + -11.172323888318175, + -25.024961990153656, + 22.26478329228287, + 35.29130058751991, + -86.18817022134313 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 58.334503173828125, + -94.23045349121094, + 67.69306945800781, + 36.0666389465332, + -17.115114212036133, + -59.2606315612793, + 43.77507781982422, + 14.875581741333008, + -22.50856590270996, + -98.67680358886719, + -2.315542221069336, + 89.86896514892578, + 14.28854751586914, + -16.22245216369629, + 4.688417911529541, + 44.46965026855469, + 52.139259338378906, + -24.165390014648438, + 66.4577865600586, + 11.172324180603027, + 25.024961471557617, + -22.26478385925293, + -35.29130172729492, + 86.18817138671875 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/pad.json b/testing/web-platform/tests/webnn/resources/test_data/pad.json new file mode 100644 index 0000000000..ac4834d7f0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/pad.json @@ -0,0 +1,757 @@ +{ + "tests": [ + { + "name": "pad float32 1D tensor default options", + "inputs": { + "input": { + "shape": [9], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [1], + "endingPadding": [1], + "expected": { + "shape": [11], + "data": [ + 0, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 2D tensor default options", + "inputs": { + "input": { + "shape": [3, 3], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [1, 1], + "endingPadding": [1, 1], + "expected": { + "shape": [5, 5], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + 0, + 0, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 0, + 0, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 3D tensor default options", + "inputs": { + "input": { + "shape": [1, 3, 3], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [1, 1, 1], + "endingPadding": [1, 1, 1], + "expected": { + "shape": [3, 5, 5], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + 0, + 0, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 0, + 0, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 4D tensor default options", + "inputs": { + "input": { + "shape": [1, 3, 3, 1], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [0, 1, 1, 1], + "endingPadding": [0, 1, 1, 1], + "expected": { + "shape": [1, 5, 5, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 22.76361846923828, + 0, + 0, + -21.168529510498047, + 0, + 0, + -91.66168975830078, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 16.863798141479492, + 0, + 0, + 60.51472091674805, + 0, + 0, + -70.56755065917969, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + -60.643272399902344, + 0, + 0, + -47.8821907043457, + 0, + 0, + 68.72557830810547, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 5D tensor default options", + "inputs": { + "input": { + "shape": [1, 3, 3, 1, 1], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [0, 1, 1, 0, 1], + "endingPadding": [0, 1, 1, 0, 1], + "expected": { + "shape": [1, 5, 5, 1, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 22.76361846923828, + 0, + 0, + -21.168529510498047, + 0, + 0, + -91.66168975830078, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 16.863798141479492, + 0, + 0, + 60.51472091674805, + 0, + 0, + -70.56755065917969, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + -60.643272399902344, + 0, + 0, + -47.8821907043457, + 0, + 0, + 68.72557830810547, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 2D tensor explicit options.mode='constant'", + "inputs": { + "input": { + "shape": [3, 3], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [1, 1], + "endingPadding": [1, 1], + "options": { + "mode": "constant" + }, + "expected": { + "shape": [5, 5], + "data": [ + 0, + 0, + 0, + 0, + 0, + 0, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + 0, + 0, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 0, + 0, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "float32" + } + }, + { + "name": "pad float32 2D tensor options.value default constant mode", + "inputs": { + "input": { + "shape": [3, 3], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [1, 1], + "endingPadding": [1, 1], + "options": { + "value": 1.0 + }, + "expected": { + "shape": [5, 5], + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + 1, + 1, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 1, + 1, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "type": "float32" + } + }, + { + "name": "pad float32 4D tensor options.mode='edge'", + "inputs": { + "input": { + "shape": [1, 3, 3, 1], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [0, 2, 2, 0], + "endingPadding": [0, 2, 2, 0], + "options": { + "mode": "edge" + }, + "expected": { + "shape": [1, 7, 7, 1], + "data": [ + 22.76361846923828, + 22.76361846923828, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -91.66168975830078, + -91.66168975830078, + 22.76361846923828, + 22.76361846923828, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -91.66168975830078, + -91.66168975830078, + 22.76361846923828, + 22.76361846923828, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -91.66168975830078, + -91.66168975830078, + 16.863798141479492, + 16.863798141479492, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + -70.56755065917969, + -70.56755065917969, + -60.643272399902344, + -60.643272399902344, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 68.72557830810547, + 68.72557830810547, + -60.643272399902344, + -60.643272399902344, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 68.72557830810547, + 68.72557830810547, + -60.643272399902344, + -60.643272399902344, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 68.72557830810547, + 68.72557830810547 + ], + "type": "float32" + } + }, + { + "name": "pad float32 4D tensor options.mode='reflection'", + "inputs": { + "input": { + "shape": [1, 3, 3, 1], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [0, 2, 2, 0], + "endingPadding": [0, 2, 2, 0], + "options": { + "mode": "reflection" + }, + "expected": { + "shape": [1, 7, 7, 1], + "data": [ + 68.72557830810547, + -47.8821907043457, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + -47.8821907043457, + -60.643272399902344, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + -91.66168975830078, + -21.168529510498047, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -21.168529510498047, + 22.76361846923828, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + 68.72557830810547, + -47.8821907043457, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + -47.8821907043457, + -60.643272399902344, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + 60.51472091674805, + 16.863798141479492, + -91.66168975830078, + -21.168529510498047, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -21.168529510498047, + 22.76361846923828 + ], + "type": "float32" + } + }, + { + "name": "pad float32 4D tensor options.mode='symmetric'", + "inputs": { + "input": { + "shape": [1, 3, 3, 1], + "data": [ + 22.763617617214834, + -21.16852940391331, + -91.66169283838785, + 16.863798710594182, + 60.51471999839896, + -70.56754852642953, + -60.64327110324324, + -47.88219132680065, + 68.7255776612235 + ], + "type": "float32" + } + }, + "beginningPadding": [0, 2, 2, 0], + "endingPadding": [0, 2, 2, 0], + "options": { + "mode": "symmetric" + }, + "expected": { + "shape": [1, 7, 7, 1], + "data": [ + 60.51472091674805, + 16.863798141479492, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + -70.56755065917969, + 60.51472091674805, + -21.168529510498047, + 22.76361846923828, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -91.66168975830078, + -21.168529510498047, + -21.168529510498047, + 22.76361846923828, + 22.76361846923828, + -21.168529510498047, + -91.66168975830078, + -91.66168975830078, + -21.168529510498047, + 60.51472091674805, + 16.863798141479492, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + -70.56755065917969, + 60.51472091674805, + -47.8821907043457, + -60.643272399902344, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 68.72557830810547, + -47.8821907043457, + -47.8821907043457, + -60.643272399902344, + -60.643272399902344, + -47.8821907043457, + 68.72557830810547, + 68.72557830810547, + -47.8821907043457, + 60.51472091674805, + 16.863798141479492, + 16.863798141479492, + 60.51472091674805, + -70.56755065917969, + -70.56755065917969, + 60.51472091674805 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/pow.json b/testing/web-platform/tests/webnn/resources/test_data/pow.json new file mode 100644 index 0000000000..d6c9f592df --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/pow.json @@ -0,0 +1,1072 @@ +{ + "tests": [ + { + "name": "pow float32 1D base tensor and 1D integer exponent tensor", + "inputs": { + "a": { + "shape": [24], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + 1, + 6, + -7, + 7, + -2, + 1, + 4, + -10, + -2, + -5, + -2, + -10, + -8, + -7, + -1, + -3, + -9, + 6, + -6, + 7, + -5, + -5, + 7, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 17.846010208129883, + 6.316321332633379e-8, + -1.0973203501407625e-7, + 21800822, + 0.0033234376460313797, + 11.862250328063965, + 80273.3359375, + 0.00005692423656000756, + 0.12908191978931427, + -0.0000020299064544815337, + 0.005799346603453159, + 3880.540283203125, + 2.7385585465999895e-10, + 8.223764069725803e-8, + 0.06714485585689545, + -0.008288968354463577, + -4.1750155416186985e-11, + 1210.5478515625, + 3.8231124932508465e-8, + -1667.201416015625, + -0.16149713099002838, + -0.00015812950732652098, + 485079424, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 2D base tensor and 2D integer exponent tensor", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + 1, + 6, + -7, + 7, + -2, + 1, + 4, + -10, + -2, + -5, + -2, + -10, + -8, + -7, + -1, + -3, + -9, + 6, + -6, + 7, + -5, + -5, + 7, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 17.846010208129883, + 6.316321332633379e-8, + -1.0973203501407625e-7, + 21800822, + 0.0033234376460313797, + 11.862250328063965, + 80273.3359375, + 0.00005692423656000756, + 0.12908191978931427, + -0.0000020299064544815337, + 0.005799346603453159, + 3880.540283203125, + 2.7385585465999895e-10, + 8.223764069725803e-8, + 0.06714485585689545, + -0.008288968354463577, + -4.1750155416186985e-11, + 1210.5478515625, + 3.8231124932508465e-8, + -1667.201416015625, + -0.16149713099002838, + -0.00015812950732652098, + 485079424, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 3D base tensor and 3D integer exponent tensor", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + 1, + 6, + -7, + 7, + -2, + 1, + 4, + -10, + -2, + -5, + -2, + -10, + -8, + -7, + -1, + -3, + -9, + 6, + -6, + 7, + -5, + -5, + 7, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 17.846010208129883, + 6.316321332633379e-8, + -1.0973203501407625e-7, + 21800822, + 0.0033234376460313797, + 11.862250328063965, + 80273.3359375, + 0.00005692423656000756, + 0.12908191978931427, + -0.0000020299064544815337, + 0.005799346603453159, + 3880.540283203125, + 2.7385585465999895e-10, + 8.223764069725803e-8, + 0.06714485585689545, + -0.008288968354463577, + -4.1750155416186985e-11, + 1210.5478515625, + 3.8231124932508465e-8, + -1667.201416015625, + -0.16149713099002838, + -0.00015812950732652098, + 485079424, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D base tensor and 4D integer exponent tensor", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 6, + -7, + 7, + -2, + 1, + 4, + -10, + -2, + -5, + -2, + -10, + -8, + -7, + -1, + -3, + -9, + 6, + -6, + 7, + -5, + -5, + 7, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 17.846010208129883, + 6.316321332633379e-8, + -1.0973203501407625e-7, + 21800822, + 0.0033234376460313797, + 11.862250328063965, + 80273.3359375, + 0.00005692423656000756, + 0.12908191978931427, + -0.0000020299064544815337, + 0.005799346603453159, + 3880.540283203125, + 2.7385585465999895e-10, + 8.223764069725803e-8, + 0.06714485585689545, + -0.008288968354463577, + -4.1750155416186985e-11, + 1210.5478515625, + 3.8231124932508465e-8, + -1667.201416015625, + -0.16149713099002838, + -0.00015812950732652098, + 485079424, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 5D base tensor and 5D integer exponent tensor", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 1, + 6, + -7, + 7, + -2, + 1, + 4, + -10, + -2, + -5, + -2, + -10, + -8, + -7, + -1, + -3, + -9, + 6, + -6, + 7, + -5, + -5, + 7, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2, 3], + "data": [ + 17.846010208129883, + 6.316321332633379e-8, + -1.0973203501407625e-7, + 21800822, + 0.0033234376460313797, + 11.862250328063965, + 80273.3359375, + 0.00005692423656000756, + 0.12908191978931427, + -0.0000020299064544815337, + 0.005799346603453159, + 3880.540283203125, + 2.7385585465999895e-10, + 8.223764069725803e-8, + 0.06714485585689545, + -0.008288968354463577, + -4.1750155416186985e-11, + 1210.5478515625, + 3.8231124932508465e-8, + -1667.201416015625, + -0.16149713099002838, + -0.00015812950732652098, + 485079424, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 1D positive base tensor and 1D exponent tensor", + "inputs": { + "a": { + "shape": [24], + "data": [ + 1.4186520416325132, + 19.384846302672862, + 12.983916515701083, + 2.460315836803, + 7.818154966175683, + 6.944444510618668, + 12.183951502858129, + 17.91247403540764, + 11.35656818684932, + 8.924248275595188, + 17.63682367890858, + 11.49622917976384, + 18.51627975602645, + 2.2580489773802714, + 2.231948203000913, + 13.629855345962834, + 17.54841363842334, + 0.5390733851574936, + 5.891367616729561, + 0.12803148642270834, + 19.654494983574544, + 3.412272498152542, + 4.9450348267065225, + 4.437101298745225 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -1.5511157816056738, + 19.380577557084465, + -3.6426215860281452, + 16.167571318689518, + -2.0848799217875964, + 11.261693793617642, + 12.615325041672058, + -2.7793194614392647, + -11.366388615297627, + -5.648841807865415, + 11.413243516798275, + 12.879077210007082, + 0.4005270071745244, + -6.527585857242606, + 2.407976905841956, + -9.631716701331072, + -0.2599778139698401, + -9.364569334111161, + 15.316681121612149, + 7.0153143060793965, + -11.982424302485697, + -12.112285237422382, + 14.26965166637288, + -6.536952275641514 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.5813302397727966, + 8.948769192887517e+24, + 0.00008795983740128577, + 2095912.875, + 0.013739941641688347, + 3007905536, + 49839131852800, + 0.00032891242881305516, + 1.01309802560956e-12, + 0.000004269440978532657, + 168150804987904, + 45601043513344, + 3.218766689300537, + 0.004908796865493059, + 6.912310600280762, + 1.1827739308800655e-11, + 0.4748164415359497, + 325.8381042480469, + 626836635648, + 5.464456762638292e-7, + 3.170955982412547e-16, + 3.496410840853059e-7, + 8045534720, + 0.00005887653969693929 + ], + "type": "float32" + } + }, + { + "name": "pow float32 2D positive base tensor and 2D exponent tensor", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 1.4186520416325132, + 19.384846302672862, + 12.983916515701083, + 2.460315836803, + 7.818154966175683, + 6.944444510618668, + 12.183951502858129, + 17.91247403540764, + 11.35656818684932, + 8.924248275595188, + 17.63682367890858, + 11.49622917976384, + 18.51627975602645, + 2.2580489773802714, + 2.231948203000913, + 13.629855345962834, + 17.54841363842334, + 0.5390733851574936, + 5.891367616729561, + 0.12803148642270834, + 19.654494983574544, + 3.412272498152542, + 4.9450348267065225, + 4.437101298745225 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -1.5511157816056738, + 19.380577557084465, + -3.6426215860281452, + 16.167571318689518, + -2.0848799217875964, + 11.261693793617642, + 12.615325041672058, + -2.7793194614392647, + -11.366388615297627, + -5.648841807865415, + 11.413243516798275, + 12.879077210007082, + 0.4005270071745244, + -6.527585857242606, + 2.407976905841956, + -9.631716701331072, + -0.2599778139698401, + -9.364569334111161, + 15.316681121612149, + 7.0153143060793965, + -11.982424302485697, + -12.112285237422382, + 14.26965166637288, + -6.536952275641514 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.5813302397727966, + 8.948769192887517e+24, + 0.00008795983740128577, + 2095912.875, + 0.013739941641688347, + 3007905536, + 49839131852800, + 0.00032891242881305516, + 1.01309802560956e-12, + 0.000004269440978532657, + 168150804987904, + 45601043513344, + 3.218766689300537, + 0.004908796865493059, + 6.912310600280762, + 1.1827739308800655e-11, + 0.4748164415359497, + 325.8381042480469, + 626836635648, + 5.464456762638292e-7, + 3.170955982412547e-16, + 3.496410840853059e-7, + 8045534720, + 0.00005887653969693929 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D positive base tensor and 4D exponent tensor", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 1.4186520416325132, + 19.384846302672862, + 12.983916515701083, + 2.460315836803, + 7.818154966175683, + 6.944444510618668, + 12.183951502858129, + 17.91247403540764, + 11.35656818684932, + 8.924248275595188, + 17.63682367890858, + 11.49622917976384, + 18.51627975602645, + 2.2580489773802714, + 2.231948203000913, + 13.629855345962834, + 17.54841363842334, + 0.5390733851574936, + 5.891367616729561, + 0.12803148642270834, + 19.654494983574544, + 3.412272498152542, + 4.9450348267065225, + 4.437101298745225 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -1.5511157816056738, + 19.380577557084465, + -3.6426215860281452, + 16.167571318689518, + -2.0848799217875964, + 11.261693793617642, + 12.615325041672058, + -2.7793194614392647, + -11.366388615297627, + -5.648841807865415, + 11.413243516798275, + 12.879077210007082, + 0.4005270071745244, + -6.527585857242606, + 2.407976905841956, + -9.631716701331072, + -0.2599778139698401, + -9.364569334111161, + 15.316681121612149, + 7.0153143060793965, + -11.982424302485697, + -12.112285237422382, + 14.26965166637288, + -6.536952275641514 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.5813302397727966, + 8.948769192887517e+24, + 0.00008795983740128577, + 2095912.875, + 0.013739941641688347, + 3007905536, + 49839131852800, + 0.00032891242881305516, + 1.01309802560956e-12, + 0.000004269440978532657, + 168150804987904, + 45601043513344, + 3.218766689300537, + 0.004908796865493059, + 6.912310600280762, + 1.1827739308800655e-11, + 0.4748164415359497, + 325.8381042480469, + 626836635648, + 5.464456762638292e-7, + 3.170955982412547e-16, + 3.496410840853059e-7, + 8045534720, + 0.00005887653969693929 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D exponent tensor and broadcastable 1D positive base tensor", + "inputs": { + "a": { + "shape": [1], + "data": [ + 11.594479317507522 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 9831930832107864000, + 0.8567188382148743, + 3.145953983429983e-11, + 786871222272, + 3.4610242370650813e-19, + 4211286999040, + 1.2196345930224334e-18, + 673.3303833007812, + 0.0010909875854849815, + 2.2894641996167248e-15, + 94425837469696, + 0.34217458963394165, + 2.0603237680819727e-17, + 87906598912, + 7080751803662336, + 0.000005512045390787534, + 7.14127336841233e-16, + 2980.96923828125, + 2168419861221343200, + 0.0008485119906254113, + 0.029340136796236038, + 7.466013585144538e-7, + 3388161848544067600, + 3421086174482006000 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D base tensor and broadcastable 2D integer exponent tensor", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + 5, + -10, + -10, + 7, + -7, + -9 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1810113, + 998220038144, + 1.1418765932802444e-10, + 21800822, + -2.11619832768406e-9, + 2.1502860603206386e-10, + -1351182.875, + 0.00005692423656000756, + 0.000035836616007145494, + -93225256, + 1.4853429597394552e-8, + -1698.2552490234375, + -947433.5, + 7.562621362477984e-11, + 1.8626330946375225e-12, + -71917.1015625, + -8.45626324519344e-9, + 0.00002374253199377563, + 1518165.5, + 0.00002495513399480842, + 0.026081321761012077, + -209595.46875, + 2.0615180673644318e-9, + 6.786416914539295e-12 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D base tensor and broadcastable 3D integer exponent tensor", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -5, + -10, + 9, + -6 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 5.524516950572433e-7, + -999109.625, + -0.000010685862434911542, + 3.284485530774539e-11, + 4.0545030440680696e-13, + 1.81271334748212e-11, + -108463955968, + 6610.47265625, + -10025.4921875, + 1.4756086841316574e-7, + 1.9504606996179064e-7, + 142.34274291992188, + -0.0000010554830396358739, + 0.000008696333679836243, + 0.0000013647832020069472, + 1.1525726506533829e-7, + 2.9335795945217846e-12, + 0.000007272717084561009, + 133774827520, + -13885.326171875, + -26.625843048095703, + 0.000027467271138448268, + 3.5893645389251105e-8, + 3.584487018315485e-8 + ], + "type": "float32" + } + }, + { + "name": "pow float32 4D exponent tensor and broadcastable 4D positive base tensor", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 11.594479317507522 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 17.84601042972939, + -0.06310698009783522, + -9.868203150557209, + 11.177720889025082, + -17.346274412274497, + 11.862249907078805, + -16.832276297112916, + 2.657481705284937, + -2.783346559701183, + -13.756399883988184, + 13.131383020668672, + -0.4376337155223524, + -15.678688537967744, + 10.283306376871472, + 14.89317426754188, + -4.941208383494091, + -14.231812435141862, + 3.2646027287637835, + 17.229148713687444, + -2.885918185998449, + -1.440015043233842, + -5.757015935913907, + 17.41126899618849, + 17.415215284302022 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 9831930832107864000, + 0.8567188382148743, + 3.145953983429983e-11, + 786871222272, + 3.4610242370650813e-19, + 4211286999040, + 1.2196345930224334e-18, + 673.3303833007812, + 0.0010909875854849815, + 2.2894641996167248e-15, + 94425837469696, + 0.34217458963394165, + 2.0603237680819727e-17, + 87906598912, + 7080751803662336, + 0.000005512045390787534, + 7.14127336841233e-16, + 2980.96923828125, + 2168419861221343200, + 0.0008485119906254113, + 0.029340136796236038, + 7.466013585144538e-7, + 3388161848544067600, + 3421086174482006000 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/prelu.json b/testing/web-platform/tests/webnn/resources/test_data/prelu.json new file mode 100644 index 0000000000..e45e12cd4b --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/prelu.json @@ -0,0 +1,868 @@ +{ + "tests": [ + { + "name": "prelu float32 1D tensors", + "inputs": { + "x": { + "shape": [24], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [24], + "data": [ + 9.343093097130314, + 0.2800687126385206, + -4.617085001507579, + 1.1202747481570352, + -1.4334710772165593, + -3.157594908065091, + -6.289953987035659, + -5.010787777546328, + -6.899077379471157, + 3.572534824190212, + 6.861966530502535, + -1.9615313732548287, + 4.583203900668886, + 2.664350255679274, + 9.19295531798543, + -9.554700087649, + -5.505102187715796, + -2.3927369956553557, + 3.5821293765315954, + -2.32240037283157, + -1.9816573593209075, + 4.155890213640276, + -1.7995220850663962, + 9.29585020267449 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + -23.817113876342773, + -1.342889666557312, + 8.413617134094238, + 6.108623504638672, + 12.173455238342285, + 3.3143365383148193, + 1.1687211990356445, + 0.7103435397148132, + 46.32490539550781, + 5.787421703338623, + -25.7709903717041, + 9.608142852783203, + 7.3295159339904785, + -10.535453796386719, + 7.067296981811523, + 9.439736366271973, + 14.083043098449707, + 20.718313217163086, + 8.47507381439209, + 4.551425457000732, + 18.365745544433594, + -1.0895805358886719, + 1.3258955478668213, + -68.95950317382812 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 2D tensors", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [4, 6], + "data": [ + 9.343093097130314, + 0.2800687126385206, + -4.617085001507579, + 1.1202747481570352, + -1.4334710772165593, + -3.157594908065091, + -6.289953987035659, + -5.010787777546328, + -6.899077379471157, + 3.572534824190212, + 6.861966530502535, + -1.9615313732548287, + 4.583203900668886, + 2.664350255679274, + 9.19295531798543, + -9.554700087649, + -5.505102187715796, + -2.3927369956553557, + 3.5821293765315954, + -2.32240037283157, + -1.9816573593209075, + 4.155890213640276, + -1.7995220850663962, + 9.29585020267449 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + -23.817113876342773, + -1.342889666557312, + 8.413617134094238, + 6.108623504638672, + 12.173455238342285, + 3.3143365383148193, + 1.1687211990356445, + 0.7103435397148132, + 46.32490539550781, + 5.787421703338623, + -25.7709903717041, + 9.608142852783203, + 7.3295159339904785, + -10.535453796386719, + 7.067296981811523, + 9.439736366271973, + 14.083043098449707, + 20.718313217163086, + 8.47507381439209, + 4.551425457000732, + 18.365745544433594, + -1.0895805358886719, + 1.3258955478668213, + -68.95950317382812 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 3D tensors", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [2, 3, 4], + "data": [ + 9.343093097130314, + 0.2800687126385206, + -4.617085001507579, + 1.1202747481570352, + -1.4334710772165593, + -3.157594908065091, + -6.289953987035659, + -5.010787777546328, + -6.899077379471157, + 3.572534824190212, + 6.861966530502535, + -1.9615313732548287, + 4.583203900668886, + 2.664350255679274, + 9.19295531798543, + -9.554700087649, + -5.505102187715796, + -2.3927369956553557, + 3.5821293765315954, + -2.32240037283157, + -1.9816573593209075, + 4.155890213640276, + -1.7995220850663962, + 9.29585020267449 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + -23.817113876342773, + -1.342889666557312, + 8.413617134094238, + 6.108623504638672, + 12.173455238342285, + 3.3143365383148193, + 1.1687211990356445, + 0.7103435397148132, + 46.32490539550781, + 5.787421703338623, + -25.7709903717041, + 9.608142852783203, + 7.3295159339904785, + -10.535453796386719, + 7.067296981811523, + 9.439736366271973, + 14.083043098449707, + 20.718313217163086, + 8.47507381439209, + 4.551425457000732, + 18.365745544433594, + -1.0895805358886719, + 1.3258955478668213, + -68.95950317382812 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 4D tensors", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [2, 2, 2, 3], + "data": [ + 9.343093097130314, + 0.2800687126385206, + -4.617085001507579, + 1.1202747481570352, + -1.4334710772165593, + -3.157594908065091, + -6.289953987035659, + -5.010787777546328, + -6.899077379471157, + 3.572534824190212, + 6.861966530502535, + -1.9615313732548287, + 4.583203900668886, + 2.664350255679274, + 9.19295531798543, + -9.554700087649, + -5.505102187715796, + -2.3927369956553557, + 3.5821293765315954, + -2.32240037283157, + -1.9816573593209075, + 4.155890213640276, + -1.7995220850663962, + 9.29585020267449 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -23.817113876342773, + -1.342889666557312, + 8.413617134094238, + 6.108623504638672, + 12.173455238342285, + 3.3143365383148193, + 1.1687211990356445, + 0.7103435397148132, + 46.32490539550781, + 5.787421703338623, + -25.7709903717041, + 9.608142852783203, + 7.3295159339904785, + -10.535453796386719, + 7.067296981811523, + 9.439736366271973, + 14.083043098449707, + 20.718313217163086, + 8.47507381439209, + 4.551425457000732, + 18.365745544433594, + -1.0895805358886719, + 1.3258955478668213, + -68.95950317382812 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 5D tensors", + "inputs": { + "x": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 9.343093097130314, + 0.2800687126385206, + -4.617085001507579, + 1.1202747481570352, + -1.4334710772165593, + -3.157594908065091, + -6.289953987035659, + -5.010787777546328, + -6.899077379471157, + 3.572534824190212, + 6.861966530502535, + -1.9615313732548287, + 4.583203900668886, + 2.664350255679274, + 9.19295531798543, + -9.554700087649, + -5.505102187715796, + -2.3927369956553557, + 3.5821293765315954, + -2.32240037283157, + -1.9816573593209075, + 4.155890213640276, + -1.7995220850663962, + 9.29585020267449 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + -23.817113876342773, + -1.342889666557312, + 8.413617134094238, + 6.108623504638672, + 12.173455238342285, + 3.3143365383148193, + 1.1687211990356445, + 0.7103435397148132, + 46.32490539550781, + 5.787421703338623, + -25.7709903717041, + 9.608142852783203, + 7.3295159339904785, + -10.535453796386719, + 7.067296981811523, + 9.439736366271973, + 14.083043098449707, + 20.718313217163086, + 8.47507381439209, + 4.551425457000732, + 18.365745544433594, + -1.0895805358886719, + 1.3258955478668213, + -68.95950317382812 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 broadcast 4D x 1D slope", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [3], // broadcast [3] --> [2, 2, 2, 3] + "data": [ + 5.073923296191488, + 0.48077445494619653, + -7.091750168010829 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -12.934283256530762, + -2.3052449226379395, + 8.413617134094238, + 6.108623504638672, + -4.082877159118652, + 3.3143365383148193, + 1.1687211990356445, + -0.06815595179796219, + 47.61863327026367, + 5.787421703338623, + -1.8056097030639648, + 34.737422943115234, + 7.3295159339904785, + -1.901092767715454, + 7.067296981811523, + 9.439736366271973, + -1.2299076318740845, + 61.40629196166992, + 8.47507381439209, + 4.551425457000732, + 65.72542572021484, + -1.330268144607544, + 1.3258955478668213, + 52.60881042480469 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 broadcast 4D x 1D slope of shape [1]", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [1], // broadcast [1] --> [2, 2, 2, 3] + "data": [ + 5.0114545056636395 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -12.775040626525879, + -24.029211044311523, + 8.413617134094238, + 6.108623504638672, + -42.558738708496094, + 3.3143365383148193, + 1.1687211990356445, + -0.7104380130767822, + -33.65017318725586, + 5.787421703338623, + -18.821155548095703, + -24.54753875732422, + 7.3295159339904785, + -19.816442489624023, + 7.067296981811523, + 9.439736366271973, + -12.82020378112793, + -43.39335632324219, + 8.47507381439209, + 4.551425457000732, + -46.44551467895508, + -1.3138903379440308, + 1.3258955478668213, + -37.17652893066406 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 broadcast 4D x 2D slope", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [2, 3], // broadcast [2, 3] --> [2, 2, 2, 3] + "data": [ + 4.8742760041637645, + -8.50163357869285, + 1.1819270477816914, + -9.985190366937573, + -4.424202960837338, + -6.654683521499036 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -12.425349235534668, + 40.764122009277344, + 8.413617134094238, + 6.108623504638672, + 37.571624755859375, + 3.3143365383148193, + 1.1687211990356445, + 1.2052156925201416, + -7.936229228973389, + 5.787421703338623, + 16.615657806396484, + 32.5965461730957, + 7.3295159339904785, + 33.61741256713867, + 7.067296981811523, + 9.439736366271973, + 11.31790828704834, + 57.621803283691406, + 8.47507381439209, + 4.551425457000732, + -10.953948020935059, + 2.617891550064087, + 1.3258955478668213, + 49.366512298583984 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 broadcast 4D x 3D slope", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [1, 1, 3], // broadcast [1, 1, 3] --> [2, 2, 2, 3] + "data": [ + 5.073923296191488, + 0.48077445494619653, + -7.091750168010829 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -12.934283256530762, + -2.3052449226379395, + 8.413617134094238, + 6.108623504638672, + -4.082877159118652, + 3.3143365383148193, + 1.1687211990356445, + -0.06815595179796219, + 47.61863327026367, + 5.787421703338623, + -1.8056097030639648, + 34.737422943115234, + 7.3295159339904785, + -1.901092767715454, + 7.067296981811523, + 9.439736366271973, + -1.2299076318740845, + 61.40629196166992, + 8.47507381439209, + 4.551425457000732, + 65.72542572021484, + -1.330268144607544, + 1.3258955478668213, + 52.60881042480469 + ], + "type": "float32" + } + }, + { + "name": "prelu float32 broadcast 4D x 4D slope", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -2.5491681672317235, + -4.794857500523286, + 8.413617520687886, + 6.108623511441287, + -8.492292847462334, + 3.3143364551069876, + 1.1687212422078108, + -0.1417628422981423, + -6.714651930677875, + 5.787421746282195, + -3.7556274239369847, + -4.898286418001732, + 7.329515995865023, + -3.9542297833176665, + 7.067297201348715, + 9.439736453375971, + -2.5581801134299775, + -8.658834185932482, + 8.475073893236225, + 4.551425642121982, + -9.267870491380243, + -0.26217744010265776, + 1.325895534951659, + -7.418311114031475 + ], + "type": "float32" + }, + "slope": { + "shape": [1, 1, 1, 1], // broadcast [1, 1, 1, 1] --> [2, 2, 2, 3] + "data": [ + 5.0114545056636395 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -12.775040626525879, + -24.029211044311523, + 8.413617134094238, + 6.108623504638672, + -42.558738708496094, + 3.3143365383148193, + 1.1687211990356445, + -0.7104380130767822, + -33.65017318725586, + 5.787421703338623, + -18.821155548095703, + -24.54753875732422, + 7.3295159339904785, + -19.816442489624023, + 7.067296981811523, + 9.439736366271973, + -12.82020378112793, + -43.39335632324219, + 8.47507381439209, + 4.551425457000732, + -46.44551467895508, + -1.3138903379440308, + 1.3258955478668213, + -37.17652893066406 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_l1.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_l1.json new file mode 100644 index 0000000000..aa169299c7 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_l1.json @@ -0,0 +1,702 @@ +{ + "tests": [ + { + "name": "reduceL1 float32 1D tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -98.83928567774318, + -57.66743928106195, + -57.101201850012814, + -6.693042101576822, + -45.305847421047595, + -86.68338950685379, + -74.71875033016443, + -76.46740234611214, + -75.37676973458242, + -18.22093937407911, + -54.64426752595342, + -36.45240031615904, + -18.322682023656796, + -47.94379514838312, + -40.1997828250384, + -15.830483512310494, + -48.88335705253115, + -41.60024225085446, + -20.65563368305152, + -92.29933856234294, + -46.288581883419646, + -80.57185804741187, + -25.494730168492268, + -48.96730121051369 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1215.228515625, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 18, + 29, + 35, + 36, + 4, + 76, + 41, + 18, + 53, + 29, + 25, + 94, + 26, + 1, + 3, + 68, + 39, + 25, + 87, + 30, + 39, + 75, + 76, + 66 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 993, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -92, + -52, + -88, + -78, + -20, + -73, + -42, + -57, + -39, + -75, + -17, + -36, + -81, + -24, + -88, + -91, + -76, + -5, + -44, + -66, + -96, + -8, + -69, + -27 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1344, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 142.01541137695312, + 106.62430572509766, + 175.39280700683594, + 286.7269592285156, + 169.36322021484375, + 212.59750366210938 + ], + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 258.57110595703125, + 174.42807006835938, + 102.19830322265625, + 134.52191162109375, + 207.92910766601562, + 215.07168579101562 + ], + "type": "float32" + } + }, + { + "name": "reduceL1 float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 1092.72021484375 + ], + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 1092.72021484375 + ], + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 108.43173217773438, + 315.6007995605469, + 359.5506591796875, + 309.13702392578125 + ], + "type": "float32" + } + }, + { + "name": "reduceL1 float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 5.508826448139126, + 50.61575563515446, + 1.6773050539454992, + 84.21352292914005, + 15.664374631289203, + 52.89714899357876, + 9.12515782683123, + 28.93762412170997, + 12.567061064158146, + 11.399989904078245, + 86.91246376729916, + 64.51329469980782, + 71.28342153263038, + 76.34410635436484, + 41.53409150301335, + 97.56533284219819, + 31.803831597266385, + 6.0897547388209405, + 61.70843555684953, + 69.76119433406723, + 38.91940474525253, + 52.28833355637117, + 22.31783714884341, + 99.0719229634137 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 108.43173217773438, + 315.6007995605469, + 359.5506591796875, + 309.13702392578125 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_l2.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_l2.json new file mode 100644 index 0000000000..73397cbb7a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_l2.json @@ -0,0 +1,702 @@ +{ + "tests": [ + { + "name": "reduceL2 float32 1D tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.80042739154972, + -53.00005108985402, + -59.58587770117833, + -46.14393008028177, + -49.60613922872308, + -12.832738832929593, + -88.05061277508285, + -75.56246522621561, + -50.767774970060664, + -36.96630141451547, + -26.34404432713906, + -58.905464928590476, + -94.28752832403735, + -22.780279721601616, + -84.34877530084705, + -60.477345782692815, + -41.45580712299912, + -92.84781353832356, + -85.0544854150549, + -30.23526041853337, + -47.33807956591096, + -25.26842900087003, + -78.1195878278582, + -28.3309437256642 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 292.57574462890625, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 4, + 29, + 8, + 56, + 42, + 78, + 89, + 64, + 56, + 81, + 85, + 18, + 6, + 39, + 35, + 63, + 87, + 50, + 81, + 89, + 5, + 8, + 37, + 37 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 274.4029846191406, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -70, + -78, + -65, + -77, + -25, + -47, + -63, + -67, + -66, + -15, + -28, + -75, + -88, + -54, + -13, + -27, + -5, + -18, + -68, + -71, + -50, + -56, + -99, + -99 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 300.3830871582031, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 122.352783203125, + 124.8213119506836, + 128.20062255859375, + 128.14801025390625, + 87.18083953857422, + 55.043975830078125 + ], + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 114.44775390625, + 110.26422882080078, + 133.47344970703125, + 64.96752166748047, + 128.0914764404297, + 101.677734375 + ], + "type": "float32" + } + }, + { + "name": "reduceL2 float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 272.0996398925781 + ], + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 272.0996398925781 + ], + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 138.580078125, + 166.67791748046875, + 149.91552734375, + 67.6578598022461 + ], + "type": "float32" + } + }, + { + "name": "reduceL2 float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 4.860227954324237, + 88.23184532015614, + 54.489688892595865, + 64.75027573238448, + 6.855991445231058, + 91.3987084155092, + 41.888577644260664, + 73.65445188651776, + 35.31573479319383, + 48.345430062443896, + 82.3919051922353, + 77.86200561022456, + 93.31141688733462, + 62.486883544675194, + 60.292898644959706, + 13.23059966965019, + 20.535988317971942, + 53.451616950541414, + 11.32008585820996, + 64.75763553379184, + 43.65894603418228, + 0.8374307376408652, + 0.6848266407317727, + 33.504704671527506 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 138.580078125, + 166.67791748046875, + 149.91552734375, + 67.6578598022461 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum.json new file mode 100644 index 0000000000..2e1fee804f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum.json @@ -0,0 +1,622 @@ +{ + "tests": [ + { + "name": "reduceLogSum float32 1D tensor all non-negative default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 1D tensor all non-negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 63, + 82, + 49, + 23, + 98, + 67, + 15, + 9, + 89, + 7, + 69, + 61, + 47, + 50, + 41, + 39, + 58, + 52, + 35, + 83, + 81, + 7, + 34, + 9 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.063048362731934, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 5.593751907348633, + 4.773046016693115, + 5.3115739822387695, + 5.2497639656066895, + 4.973392486572266, + 5.373587131500244 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 5.410027980804443, + 5.367736339569092, + 5.399682998657227, + 4.652334213256836, + 4.744638442993164, + 5.565346717834473 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 7.039101600646973 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 7.039101600646973 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 5.7273993492126465, + 5.64375114440918, + 5.453810214996338, + 5.758983135223389 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSum float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 64.54826901463852, + 97.87423374006126, + 26.529027351852186, + 79.79046651888517, + 50.394988743199434, + 14.578406888832252, + 20.86681803845336, + 32.43873432263156, + 64.91234005889837, + 71.54029915166349, + 11.13706890220647, + 55.07930697185586, + 43.791352286892106, + 13.831947671728972, + 97.39019470916091, + 35.50775651228035, + 52.275862097336166, + 82.838655037009, + 8.568099335705881, + 0.8337112078307563, + 69.23145833259072, + 3.8541642374881446, + 70.55673656397397, + 71.99264788951747 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 5.7273993492126465, + 5.64375114440918, + 5.453810214996338, + 5.758983135223389 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum_exp.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum_exp.json new file mode 100644 index 0000000000..00c55ded51 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum_exp.json @@ -0,0 +1,702 @@ +{ + "tests": [ + { + "name": "reduceLogSumExp float32 1D tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -38.42346567796924, + -16.384904409140333, + -46.629634356968474, + -45.81843819006337, + -95.61458783306942, + -90.64578309257007, + -6.279945972307587, + -24.546370226192565, + -82.15882762280646, + -76.8746037170462, + -44.181029848800904, + -97.35032678020788, + -75.52388056554437, + -97.984203822517, + -97.46591756173142, + -85.89237745468532, + -27.34196668605746, + -76.80293743058324, + -93.91905595799426, + -25.62251637659385, + -36.49762778486478, + -96.2163796024006, + -33.56049055386055, + -94.06451375473459 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -6.279904842376709, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 34, + 45, + 5, + 45, + 97, + 11, + 83, + 84, + 17, + 17, + 11, + 20, + 59, + 97, + 44, + 90, + 80, + 59, + 86, + 91, + 33, + 84, + 27, + 27 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 97.69485473632812, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -91, + -77, + -2, + -34, + -77, + -38, + -92, + -45, + -54, + -11, + -64, + -76, + -53, + -19, + -41, + -83, + -21, + -34, + -73, + -33, + -10, + -71, + -82, + -26 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -1.999541163444519, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 68.81230926513672, + 90.56975555419922, + 86.6993637084961, + 81.53412628173828, + 64.85645294189453, + 82.32090759277344 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 81.53375244140625, + 86.180908203125, + 73.63322448730469, + 75.71652221679688, + 90.55726623535156, + 86.7118148803711 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 90.59076690673828 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 90.59076690673828, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 90.59076690673828 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 90.57815551757812, + 86.18093872070312, + 73.63323211669922, + 82.69600677490234 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 66.1870735698, + 68.69164623929768, + 15.529598361334717, + 65.62419160755422, + 86.18090584091544, + 7.382064010955736, + 1.6365860724411263, + 90.55726458445135, + 86.69934561770543, + 75.7165191675748, + 67.0074429215978, + 9.943717120210827, + 25.779723516449636, + 60.15386290165083, + 73.63322249161153, + 81.53375339603328, + 64.85643136289283, + 54.04977784193004, + 33.380943217138224, + 32.50357565109678, + 61.30902295453489, + 56.95015629977242, + 35.37182024244998, + 82.32090594141081 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 90.57815551757812, + 86.18093872070312, + 73.63323211669922, + 82.69600677490234 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_max.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_max.json new file mode 100644 index 0000000000..4dd7098d03 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_max.json @@ -0,0 +1,582 @@ +{ + "tests": [ + { + "name": "reduceMax float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 90.42288208007812, + 75.90379333496094, + 94.99645233154297, + 96.55397033691406, + 99.77313232421875, + 20.253753662109375 + ], + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 62.504642486572266, + 96.55397033691406, + 99.77313232421875, + -21.557384490966797, + 94.99645233154297, + 37.28493118286133 + ], + "type": "float32" + } + }, + { + "name": "reduceMax float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 99.77313232421875 + ], + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 99.77313232421875 + ], + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 90.42288208007812, + 94.99645233154297, + 96.55397033691406, + 99.77313232421875 + ], + "type": "float32" + } + }, + { + "name": "reduceMax float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 32.166585683408215, + 90.42288038051404, + -26.341795469529572, + -7.147959324354275, + 75.90379209491468, + -48.204211355965356, + -53.094252997077795, + 66.66099234322033, + -96.16854360851454, + -88.30545253131574, + 94.99645116994563, + 37.28493087456198, + -42.209860696518845, + 96.55397216250705, + 0.8807230095547567, + 62.504641219832195, + 36.650633791794576, + 99.77313292829271, + -72.86485546227293, + -46.03200926418318, + 20.253753500247612, + -21.55738542170144, + -51.287275192229046, + -42.588327517032454 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 90.42288208007812, + 94.99645233154297, + 96.55397033691406, + 99.77313232421875 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_mean.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_mean.json new file mode 100644 index 0000000000..db20b17a83 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_mean.json @@ -0,0 +1,694 @@ +{ + "tests": [ + { + "name": "reduceMean float32 1D tensor all positive default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -37.14687069315612, + -44.50042209159177, + -6.126548413219496, + -6.321792976064302, + -76.5389783512652, + -4.137693032746782, + -20.763563935321017, + -38.74917461116718, + -36.81039848179957, + -26.274377028592966, + -12.56681966278282, + -55.28200785289164, + -20.697565065775606, + -34.19586340660584, + -45.36002983401583, + -34.996193368480235, + -67.84308553425207, + -0.7434244205683882, + -21.981258134364538, + -61.31269509631454, + -58.59896180690518, + -76.02979877636918, + -23.917405754606236, + -22.941872716763513 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -34.74319839477539, + "type": "float32" + } + }, + { + "name": "reduceMean float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 42, + 24, + 44, + 38, + 82, + 93, + 64, + 40, + 48, + 78, + 81, + 59, + 45, + 18, + 3, + 77, + 60, + 19, + 66, + 8, + 21, + 19, + 62, + 71 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 48.41666793823242, + "type": "float32" + } + }, + { + "name": "reduceMean float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -73, + -8, + -55, + -73, + -61, + -54, + -5, + -39, + -66, + -53, + -57, + -39, + -62, + -98, + -36, + -1, + -75, + -8, + -71, + -72, + -67, + -16, + -21, + -31 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -47.54166793823242, + "type": "float32" + } + }, + { + "name": "reduceMean float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "shape": [2, 3], + "data": [ + 45.46687316894531, + 49.670711517333984, + 50.94768142700195, + 44.734745025634766, + 27.777833938598633, + 23.264999389648438 + ], + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "shape": [2, 3], + "data": [ + 54.82453536987305, + 40.251548767089844, + 22.060470581054688, + 48.58541488647461, + 51.343353271484375, + 24.797523498535156 + ], + "type": "float32" + } + }, + { + "name": "reduceMean float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "shape": [1, 1, 1], + "data": [ + 40.31047439575195 + ], + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "shape": [1, 1, 1, 1], + "data": [ + 40.31047439575195 + ], + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "shape": [2, 2], + "data": [ + 52.287559509277344, + 45.10261917114258, + 47.640018463134766, + 16.211700439453125 + ], + "type": "float32" + } + }, + { + "name": "reduceMean float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 95.84498772347054, + 75.69370054099012, + 1.5417720846181426, + 8.787033906673592, + 70.08280339173061, + 13.784331379836544, + 20.006068194857885, + 94.80963809344851, + 25.829190184293417, + 94.13260521032214, + 67.72958187044576, + 16.099351117563778, + 92.19433555001908, + 11.567352371276595, + 52.705496151946285, + 22.471793133903972, + 3.6623324286590764, + 20.2102781903039, + 58.56523137489753, + 28.673493080608758, + 42.134198143189195, + 21.637750690378144, + 14.160698325191756, + 15.127351396412191 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "shape": [1, 2, 2, 1], + "data": [ + 52.287559509277344, + 45.10261917114258, + 47.640018463134766, + 16.211700439453125 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_min.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_min.json new file mode 100644 index 0000000000..db6c0e2269 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_min.json @@ -0,0 +1,582 @@ +{ + "tests": [ + { + "name": "reduceMin float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + -87.9623031616211, + -39.50931167602539, + -53.747413635253906, + -31.713542938232422, + -84.4076919555664, + -55.97655487060547 + ], + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + -58.76195526123047, + -87.9623031616211, + -70.13690185546875, + -59.40851974487305, + -84.4076919555664, + -53.747413635253906 + ], + "type": "float32" + } + }, + { + "name": "reduceMin float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + -87.9623031616211 + ], + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + -87.9623031616211 + ], + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + -87.9623031616211, + -53.747413635253906, + -84.4076919555664, + -55.97655487060547 + ], + "type": "float32" + } + }, + { + "name": "reduceMin float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -58.76195671214997, + -87.962299829198, + -70.13690195964651, + -53.61766646981643, + -39.50931280469092, + 76.48815138549966, + -18.705087479309455, + 44.78261924634546, + 30.70233967738929, + 61.463613873181146, + 77.84043646028437, + -53.747413472322414, + -31.713543832764827, + -9.735438243016588, + 77.93652481771113, + 99.01705821629525, + 73.39929943432298, + 92.08459468237234, + -59.40851905900759, + -84.40769111096932, + 75.88834177123843, + 96.02651672898816, + -55.976554418350545, + -1.791101785391234 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + -87.9623031616211, + -53.747413635253906, + -84.4076919555664, + -55.97655487060547 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_product.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_product.json new file mode 100644 index 0000000000..60484300bc --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_product.json @@ -0,0 +1,582 @@ +{ + "tests": [ + { + "name": "reduceProduct float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 7519895, + -1292816.375, + 2441721.75, + -110637.7734375, + -7380313.5, + -818030.5 + ], + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 4227263.5, + -446960.5625, + 3811296.75, + 1280298.5, + -1343475.375, + 1280118.75 + ], + "type": "float32" + } + }, + { + "name": "reduceProduct float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 1.5855958784642327e+37 + ], + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 1.5855958784642327e+37 + ], + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + -3638925568, + 6523364352, + -414643360, + 1610916352 + ], + "type": "float32" + } + }, + { + "name": "reduceProduct float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -68.75911760233478, + 99.4496130391401, + 24.860555622046746, + -44.23515424391753, + -22.69974404385384, + 79.97555172142995, + 14.46502415218545, + 49.231095225588376, + 30.058706923717068, + 69.45106401985521, + -20.15709647137976, + -58.02551401530734, + 51.89660954258355, + -2.020799112914105, + 39.392973241316554, + 26.780734701055266, + -97.97651593223856, + 48.66154478867011, + -85.19523905815305, + -18.169861657911653, + 64.83759066937682, + -14.958838503675935, + -74.50931980014732, + -11.319679210869765 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + -3638925568, + 6523364352, + -414643360, + 1610916352 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_sum.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum.json new file mode 100644 index 0000000000..6da78ae804 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum.json @@ -0,0 +1,694 @@ +{ + "tests": [ + { + "name": "reduceSum float32 1D tensor all positive default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -51.77016701194195, + -34.46467785404002, + -40.983506494422414, + -83.34922667410298, + -67.67525749941849, + -18.703119061215574, + -20.281060841405974, + -20.123054810748656, + -83.63451764199297, + -23.651085471445683, + -10.20843911447325, + -36.212902987180804, + -76.26201536868358, + -9.094745329540757, + -53.88933855716023, + -67.52341028201596, + -71.14580362299527, + -82.04484921713924, + -96.29924980334548, + -68.46700365583722, + -26.107193300700942, + -68.01821308673175, + -4.833076925370335, + -48.90069809349882 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -1163.642578125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 56, + 90, + 67, + 33, + 20, + 58, + 22, + 15, + 86, + 79, + 59, + 99, + 16, + 95, + 67, + 11, + 60, + 89, + 50, + 57, + 77, + 89, + 10, + 2 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1307, + "type": "float32" + } + }, + { + "name": "reduceSum float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -55, + -36, + -74, + -17, + -67, + -95, + -3, + -67, + -95, + -13, + -45, + -9, + -33, + -98, + -86, + -11, + -70, + -44, + -31, + -68, + -79, + -24, + -60, + -36 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": -1216, + "type": "float32" + } + }, + { + "name": "reduceSum float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "shape": [2, 3], + "data": [ + 210.44241333007812, + 104.54179382324219, + 226.2177734375, + 239.025390625, + 260.405029296875, + 273.2470397949219 + ], + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "shape": [2, 3], + "data": [ + 179.63900756835938, + 260.37457275390625, + 219.3611297607422, + 246.83712768554688, + 157.4895782470703, + 250.1780242919922 + ], + "type": "float32" + } + }, + { + "name": "reduceSum float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "shape": [1, 1, 1], + "data": [ + 1313.87939453125 + ], + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "shape": [1, 1, 1, 1], + "data": [ + 1313.87939453125 + ], + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "shape": [2, 2], + "data": [ + 355.21942138671875, + 185.98255920410156, + 362.3598937988281, + 410.3175354003906 + ], + "type": "float32" + } + }, + { + "name": "reduceSum float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 69.6038605453285, + 99.1748548274599, + 32.782341359545676, + 8.881362932730319, + 16.094296257493014, + 11.806894918510213, + 32.64223805640243, + 43.998363476438975, + 77.01777099153088, + 79.79425759062173, + 45.007949804090174, + 24.39779644056914, + 57.50268541631618, + 57.60172895173401, + 80.26985885745457, + 43.65110628848945, + 87.50368667545843, + 94.50203768533922, + 35.54289690580114, + 42.856416416096344, + 88.58631651618441, + 98.85772999308332, + 25.62685451963782, + 60.17613590317996 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "shape": [1, 2, 2, 1], + "data": [ + 355.21942138671875, + 185.98255920410156, + 362.3598937988281, + 410.3175354003906 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reduce_sum_square.json b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum_square.json new file mode 100644 index 0000000000..cf6bbb65d4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum_square.json @@ -0,0 +1,702 @@ +{ + "tests": [ + { + "name": "reduceSumSquare float32 1D tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -21.452013864072896, + -57.30725907408611, + -72.83901116638569, + -0.059761520988928396, + -71.73678939977705, + -44.61909261218302, + -43.120022676836946, + -91.33738230600645, + -33.172438449832086, + -48.55593151678299, + -95.62864137865712, + -20.876631045259614, + -16.69083735987158, + -39.52110386011864, + -7.51078560359592, + -90.59026921164444, + -42.21683259824742, + -76.74274815005997, + -98.2242026863753, + -60.27295167122231, + -74.7320278737084, + -8.543684369072977, + -59.88873484887647, + -17.99894136421551 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 80052.015625, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 1D tensor all positive integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + 52, + 48, + 2, + 66, + 30, + 39, + 14, + 23, + 81, + 94, + 78, + 64, + 38, + 16, + 63, + 11, + 46, + 95, + 17, + 47, + 40, + 53, + 87, + 43 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 71347, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 1D tensor all negative integers default options", // test with float32 values which are equivalent to integers + "inputs": { + "input": { + "shape": [24], + "data": [ + -10, + -60, + -69, + -88, + -35, + -84, + -74, + -42, + -93, + -26, + -40, + -55, + -92, + -26, + -39, + -30, + -61, + -16, + -16, + -36, + -9, + -89, + -45, + -29 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73634, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 9709.013671875, + 10817.7685546875, + 14548.470703125, + 16385.8515625, + 9287.357421875, + 12527.3974609375 + ], + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 8585.87109375, + 7700.654296875, + 19889.1796875, + 7113.0439453125, + 16775.708984375, + 13211.3994140625 + ], + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 73275.859375 + ], + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 73275.859375 + ], + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 12302.474609375, + 22772.77734375, + 26919.09765625, + 11281.5068359375 + ], + "type": "float32" + } + }, + { + "name": "reduceSumSquare float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 52.5615351837915, + 2.6261063680439234, + 82.04877759500097, + 14.401411284784604, + 33.96051675758925, + 83.93837980977771, + 47.44504659398938, + 19.177289239472593, + 13.493006439137023, + 44.15238362662202, + 86.53118079678906, + 70.20919468463771, + 25.67262870756528, + 79.73770192548034, + 66.42284577584445, + 70.40363336301188, + 13.503327808732468, + 41.22539754662389, + 6.654552839238637, + 85.79743668166222, + 89.91348950671976, + 53.55647451130674, + 39.48537158474081, + 3.9460408540454184 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 12302.474609375, + 22772.77734375, + 26919.09765625, + 11281.5068359375 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/relu.json b/testing/web-platform/tests/webnn/resources/test_data/relu.json new file mode 100644 index 0000000000..b459789147 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/relu.json @@ -0,0 +1,334 @@ +{ + "tests": [ // relu input tensor of 1D to 5D with same data values + { + "name": "relu float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 79.04725231657116, + 2.2503608756501166, + 80.73939090529203, + 63.90392076789547, + 77.67340745512104, + -71.09157819044825, + -82.74703468427575, + -26.814426600801028, + -99.16788836397058, + -35.71083406288831, + 18.36165830990626, + -37.36091648205435, + -52.8386119809162, + -10.408374773008958, + 60.60291560236189, + -13.644198913810342, + -76.54250291031946, + -8.132338049258351, + 51.51447452437017, + -51.63370281825297, + -64.567999424324, + -5.093302411117136, + 15.354103550744384, + 90.03858807393516 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 79.04724884033203, + 2.2503609657287598, + 80.73938751220703, + 63.9039192199707, + 77.67340850830078, + 0, + 0, + 0, + 0, + 0, + 18.361658096313477, + 0, + 0, + 0, + 60.6029167175293, + 0, + 0, + 0, + 51.51447296142578, + 0, + 0, + 0, + 15.354103088378906, + 90.03858947753906 + ], + "type": "float32" + } + }, + { + "name": "relu float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 79.04725231657116, + 2.2503608756501166, + 80.73939090529203, + 63.90392076789547, + 77.67340745512104, + -71.09157819044825, + -82.74703468427575, + -26.814426600801028, + -99.16788836397058, + -35.71083406288831, + 18.36165830990626, + -37.36091648205435, + -52.8386119809162, + -10.408374773008958, + 60.60291560236189, + -13.644198913810342, + -76.54250291031946, + -8.132338049258351, + 51.51447452437017, + -51.63370281825297, + -64.567999424324, + -5.093302411117136, + 15.354103550744384, + 90.03858807393516 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 79.04724884033203, + 2.2503609657287598, + 80.73938751220703, + 63.9039192199707, + 77.67340850830078, + 0, + 0, + 0, + 0, + 0, + 18.361658096313477, + 0, + 0, + 0, + 60.6029167175293, + 0, + 0, + 0, + 51.51447296142578, + 0, + 0, + 0, + 15.354103088378906, + 90.03858947753906 + ], + "type": "float32" + } + }, + { + "name": "relu float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 79.04725231657116, + 2.2503608756501166, + 80.73939090529203, + 63.90392076789547, + 77.67340745512104, + -71.09157819044825, + -82.74703468427575, + -26.814426600801028, + -99.16788836397058, + -35.71083406288831, + 18.36165830990626, + -37.36091648205435, + -52.8386119809162, + -10.408374773008958, + 60.60291560236189, + -13.644198913810342, + -76.54250291031946, + -8.132338049258351, + 51.51447452437017, + -51.63370281825297, + -64.567999424324, + -5.093302411117136, + 15.354103550744384, + 90.03858807393516 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 79.04724884033203, + 2.2503609657287598, + 80.73938751220703, + 63.9039192199707, + 77.67340850830078, + 0, + 0, + 0, + 0, + 0, + 18.361658096313477, + 0, + 0, + 0, + 60.6029167175293, + 0, + 0, + 0, + 51.51447296142578, + 0, + 0, + 0, + 15.354103088378906, + 90.03858947753906 + ], + "type": "float32" + } + }, + { + "name": "relu float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 79.04725231657116, + 2.2503608756501166, + 80.73939090529203, + 63.90392076789547, + 77.67340745512104, + -71.09157819044825, + -82.74703468427575, + -26.814426600801028, + -99.16788836397058, + -35.71083406288831, + 18.36165830990626, + -37.36091648205435, + -52.8386119809162, + -10.408374773008958, + 60.60291560236189, + -13.644198913810342, + -76.54250291031946, + -8.132338049258351, + 51.51447452437017, + -51.63370281825297, + -64.567999424324, + -5.093302411117136, + 15.354103550744384, + 90.03858807393516 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 79.04724884033203, + 2.2503609657287598, + 80.73938751220703, + 63.9039192199707, + 77.67340850830078, + 0, + 0, + 0, + 0, + 0, + 18.361658096313477, + 0, + 0, + 0, + 60.6029167175293, + 0, + 0, + 0, + 51.51447296142578, + 0, + 0, + 0, + 15.354103088378906, + 90.03858947753906 + ], + "type": "float32" + } + }, + { + "name": "relu float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 79.04725231657116, + 2.2503608756501166, + 80.73939090529203, + 63.90392076789547, + 77.67340745512104, + -71.09157819044825, + -82.74703468427575, + -26.814426600801028, + -99.16788836397058, + -35.71083406288831, + 18.36165830990626, + -37.36091648205435, + -52.8386119809162, + -10.408374773008958, + 60.60291560236189, + -13.644198913810342, + -76.54250291031946, + -8.132338049258351, + 51.51447452437017, + -51.63370281825297, + -64.567999424324, + -5.093302411117136, + 15.354103550744384, + 90.03858807393516 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 79.04724884033203, + 2.2503609657287598, + 80.73938751220703, + 63.9039192199707, + 77.67340850830078, + 0, + 0, + 0, + 0, + 0, + 18.361658096313477, + 0, + 0, + 0, + 60.6029167175293, + 0, + 0, + 0, + 51.51447296142578, + 0, + 0, + 0, + 15.354103088378906, + 90.03858947753906 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/reshape.json b/testing/web-platform/tests/webnn/resources/test_data/reshape.json new file mode 100644 index 0000000000..7d48ed3a18 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reshape.json @@ -0,0 +1,406 @@ +{ + "tests": [ + { + "name": "reshape float32 tensor to a new shape (reorder all dimensions)", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [4, 2, 3], + "expected": { + "name": "output", + "shape": [4, 2, 3], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + }, + { + "name": "reshape float32 tensor to a new shape (reduce dimensions)", + "inputs": { + "input": { + "shape": [4, 1, 1, 1, 6], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [4, 1, 1, 6], + "expected": { + "name": "output", + "shape": [4, 1, 1, 6], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + }, + { + "name": "reshape float32 tensor to a new shape (extend dimensions)", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 2, 3, 1], + "expected": { + "name": "output", + "shape": [2, 2, 2, 3, 1], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + }, + { + "name": "reshape float32 tensor to a new shape (one dimension being the special value of null)", + "inputs": { + "input": { + "shape": [3, 2, 2, 2], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [4, null, 3, 1], + "expected": { + "name": "output", + "shape": [4, 2, 3, 1], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + }, + { + "name": "reshape float32 tensor to 1D tensor", + "inputs": { + "input": { + "shape": [3, 2, 2, 2], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [24], + "expected": { + "name": "output", + "shape": [24], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + }, + { + "name": "reshape float32 tensor to 1D tensor newShape=[null]", + "inputs": { + "input": { + "shape": [3, 2, 2, 2], + "data": [ + -30.056147250771076, + 99.5694232746736, + 88.04620115823073, + -91.87507576772606, + -23.797235323955633, + -91.28665022600151, + -63.15204449663816, + 12.066952464893262, + -96.1172904235943, + -44.77365489782947, + -80.08650883940432, + -64.4375694650447, + 27.641954235862485, + -96.86306613475395, + 83.68347403572196, + 50.599484132010815, + -20.187656772788642, + -1.3904608012750117, + -96.9360325497362, + 65.34144119048645, + 34.835993949837274, + 62.01485845563673, + -2.8698414892852355, + 27.903749097190158 + ], + "type": "float32" + } + }, + "newShape": [null], + "expected": { + "name": "output", + "shape": [24], + "data": [ + -30.0561466217041, + 99.56941986083984, + 88.04620361328125, + -91.87507629394531, + -23.7972354888916, + -91.28665161132812, + -63.15204620361328, + 12.0669527053833, + -96.1172866821289, + -44.77365493774414, + -80.08650970458984, + -64.43756866455078, + 27.64195442199707, + -96.86306762695312, + 83.6834716796875, + 50.599483489990234, + -20.18765640258789, + -1.3904608488082886, + -96.93603515625, + 65.34143829345703, + 34.835994720458984, + 62.01485824584961, + -2.8698415756225586, + 27.903749465942383 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/sigmoid.json b/testing/web-platform/tests/webnn/resources/test_data/sigmoid.json new file mode 100644 index 0000000000..c233336321 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sigmoid.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "sigmoid float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + -0.3769951326450487, + -0.6848450678710742, + -5.98887201399973, + 4.431885748123033, + -0.9386848809986663, + 4.591195578857441, + -2.5067027776293456, + 1.5669522849917055, + -2.596473257404651, + -3.647293770068697, + 2.6785236795981433, + -3.105160168372808, + 2.258501824714781, + -0.2865157795154527, + 4.640436413897461, + 1.0606156163391969, + -3.536252613252593, + 0.44104409560934066, + 4.79146007344656, + 2.0745488579530846, + 0.8354471082395971, + -5.433595857448718, + -4.184835816765236, + -2.484982429169702 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.4068518280982971, + 0.33518078923225403, + 0.0025002227630466223, + 0.9882476925849915, + 0.28116607666015625, + 0.9899610877037048, + 0.07538963109254837, + 0.8273487091064453, + 0.0693657398223877, + 0.02539960853755474, + 0.9357474446296692, + 0.04289489984512329, + 0.9053813815116882, + 0.42885708808898926, + 0.9904388189315796, + 0.7428081631660461, + 0.0282981526106596, + 0.6085078120231628, + 0.9917680025100708, + 0.8884047269821167, + 0.6975054740905762, + 0.004348373040556908, + 0.014996387995779514, + 0.07691769301891327 + ], + "type": "float32" + } + }, + { + "name": "sigmoid float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -0.3769951326450487, + -0.6848450678710742, + -5.98887201399973, + 4.431885748123033, + -0.9386848809986663, + 4.591195578857441, + -2.5067027776293456, + 1.5669522849917055, + -2.596473257404651, + -3.647293770068697, + 2.6785236795981433, + -3.105160168372808, + 2.258501824714781, + -0.2865157795154527, + 4.640436413897461, + 1.0606156163391969, + -3.536252613252593, + 0.44104409560934066, + 4.79146007344656, + 2.0745488579530846, + 0.8354471082395971, + -5.433595857448718, + -4.184835816765236, + -2.484982429169702 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.4068518280982971, + 0.33518078923225403, + 0.0025002227630466223, + 0.9882476925849915, + 0.28116607666015625, + 0.9899610877037048, + 0.07538963109254837, + 0.8273487091064453, + 0.0693657398223877, + 0.02539960853755474, + 0.9357474446296692, + 0.04289489984512329, + 0.9053813815116882, + 0.42885708808898926, + 0.9904388189315796, + 0.7428081631660461, + 0.0282981526106596, + 0.6085078120231628, + 0.9917680025100708, + 0.8884047269821167, + 0.6975054740905762, + 0.004348373040556908, + 0.014996387995779514, + 0.07691769301891327 + ], + "type": "float32" + } + }, + { + "name": "sigmoid float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -0.3769951326450487, + -0.6848450678710742, + -5.98887201399973, + 4.431885748123033, + -0.9386848809986663, + 4.591195578857441, + -2.5067027776293456, + 1.5669522849917055, + -2.596473257404651, + -3.647293770068697, + 2.6785236795981433, + -3.105160168372808, + 2.258501824714781, + -0.2865157795154527, + 4.640436413897461, + 1.0606156163391969, + -3.536252613252593, + 0.44104409560934066, + 4.79146007344656, + 2.0745488579530846, + 0.8354471082395971, + -5.433595857448718, + -4.184835816765236, + -2.484982429169702 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0.4068518280982971, + 0.33518078923225403, + 0.0025002227630466223, + 0.9882476925849915, + 0.28116607666015625, + 0.9899610877037048, + 0.07538963109254837, + 0.8273487091064453, + 0.0693657398223877, + 0.02539960853755474, + 0.9357474446296692, + 0.04289489984512329, + 0.9053813815116882, + 0.42885708808898926, + 0.9904388189315796, + 0.7428081631660461, + 0.0282981526106596, + 0.6085078120231628, + 0.9917680025100708, + 0.8884047269821167, + 0.6975054740905762, + 0.004348373040556908, + 0.014996387995779514, + 0.07691769301891327 + ], + "type": "float32" + } + }, + { + "name": "sigmoid float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -0.3769951326450487, + -0.6848450678710742, + -5.98887201399973, + 4.431885748123033, + -0.9386848809986663, + 4.591195578857441, + -2.5067027776293456, + 1.5669522849917055, + -2.596473257404651, + -3.647293770068697, + 2.6785236795981433, + -3.105160168372808, + 2.258501824714781, + -0.2865157795154527, + 4.640436413897461, + 1.0606156163391969, + -3.536252613252593, + 0.44104409560934066, + 4.79146007344656, + 2.0745488579530846, + 0.8354471082395971, + -5.433595857448718, + -4.184835816765236, + -2.484982429169702 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.4068518280982971, + 0.33518078923225403, + 0.0025002227630466223, + 0.9882476925849915, + 0.28116607666015625, + 0.9899610877037048, + 0.07538963109254837, + 0.8273487091064453, + 0.0693657398223877, + 0.02539960853755474, + 0.9357474446296692, + 0.04289489984512329, + 0.9053813815116882, + 0.42885708808898926, + 0.9904388189315796, + 0.7428081631660461, + 0.0282981526106596, + 0.6085078120231628, + 0.9917680025100708, + 0.8884047269821167, + 0.6975054740905762, + 0.004348373040556908, + 0.014996387995779514, + 0.07691769301891327 + ], + "type": "float32" + } + }, + { + "name": "sigmoid float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.3769951326450487, + -0.6848450678710742, + -5.98887201399973, + 4.431885748123033, + -0.9386848809986663, + 4.591195578857441, + -2.5067027776293456, + 1.5669522849917055, + -2.596473257404651, + -3.647293770068697, + 2.6785236795981433, + -3.105160168372808, + 2.258501824714781, + -0.2865157795154527, + 4.640436413897461, + 1.0606156163391969, + -3.536252613252593, + 0.44104409560934066, + 4.79146007344656, + 2.0745488579530846, + 0.8354471082395971, + -5.433595857448718, + -4.184835816765236, + -2.484982429169702 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.4068518280982971, + 0.33518078923225403, + 0.0025002227630466223, + 0.9882476925849915, + 0.28116607666015625, + 0.9899610877037048, + 0.07538963109254837, + 0.8273487091064453, + 0.0693657398223877, + 0.02539960853755474, + 0.9357474446296692, + 0.04289489984512329, + 0.9053813815116882, + 0.42885708808898926, + 0.9904388189315796, + 0.7428081631660461, + 0.0282981526106596, + 0.6085078120231628, + 0.9917680025100708, + 0.8884047269821167, + 0.6975054740905762, + 0.004348373040556908, + 0.014996387995779514, + 0.07691769301891327 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/sin.json b/testing/web-platform/tests/webnn/resources/test_data/sin.json new file mode 100644 index 0000000000..3cc4771a33 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sin.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "sin float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 79.78058345331559, + 55.00573351892254, + -28.052533009972393, + -31.644301395318934, + 56.28375442556609, + -96.18512135074778, + -72.99826309079677, + -3.4241827262925852, + 84.02549499853444, + 5.030371842664394, + -9.512612392430725, + 9.540593026227612, + -25.267252298101056, + -20.831639431837345, + -32.024754770208745, + -55.69102662814118, + 15.92748126354438, + -57.8835344652012, + 31.0160642695962, + -94.88304659350737, + -84.58417183546084, + 44.848744233535655, + -19.000272686086987, + -48.03827737658466 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.946033775806427, + -0.9996118545532227, + -0.21998752653598785, + -0.22639396786689758, + -0.2618238627910614, + -0.9335716366767883, + 0.6754903197288513, + 0.27884384989738464, + 0.7156150341033936, + -0.9498680830001831, + 0.08772148936986923, + -0.11555644869804382, + -0.13410548865795135, + -0.9166066646575928, + -0.5719056725502014, + 0.7563026547431946, + -0.21775959432125092, + -0.9722972512245178, + -0.38929200172424316, + -0.59339439868927, + -0.23656263947486877, + 0.7620325684547424, + -0.15014687180519104, + 0.7921885848045349 + ], + "type": "float32" + } + }, + { + "name": "sin float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 79.78058345331559, + 55.00573351892254, + -28.052533009972393, + -31.644301395318934, + 56.28375442556609, + -96.18512135074778, + -72.99826309079677, + -3.4241827262925852, + 84.02549499853444, + 5.030371842664394, + -9.512612392430725, + 9.540593026227612, + -25.267252298101056, + -20.831639431837345, + -32.024754770208745, + -55.69102662814118, + 15.92748126354438, + -57.8835344652012, + 31.0160642695962, + -94.88304659350737, + -84.58417183546084, + 44.848744233535655, + -19.000272686086987, + -48.03827737658466 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.946033775806427, + -0.9996118545532227, + -0.21998752653598785, + -0.22639396786689758, + -0.2618238627910614, + -0.9335716366767883, + 0.6754903197288513, + 0.27884384989738464, + 0.7156150341033936, + -0.9498680830001831, + 0.08772148936986923, + -0.11555644869804382, + -0.13410548865795135, + -0.9166066646575928, + -0.5719056725502014, + 0.7563026547431946, + -0.21775959432125092, + -0.9722972512245178, + -0.38929200172424316, + -0.59339439868927, + -0.23656263947486877, + 0.7620325684547424, + -0.15014687180519104, + 0.7921885848045349 + ], + "type": "float32" + } + }, + { + "name": "sin float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 79.78058345331559, + 55.00573351892254, + -28.052533009972393, + -31.644301395318934, + 56.28375442556609, + -96.18512135074778, + -72.99826309079677, + -3.4241827262925852, + 84.02549499853444, + 5.030371842664394, + -9.512612392430725, + 9.540593026227612, + -25.267252298101056, + -20.831639431837345, + -32.024754770208745, + -55.69102662814118, + 15.92748126354438, + -57.8835344652012, + 31.0160642695962, + -94.88304659350737, + -84.58417183546084, + 44.848744233535655, + -19.000272686086987, + -48.03827737658466 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.946033775806427, + -0.9996118545532227, + -0.21998752653598785, + -0.22639396786689758, + -0.2618238627910614, + -0.9335716366767883, + 0.6754903197288513, + 0.27884384989738464, + 0.7156150341033936, + -0.9498680830001831, + 0.08772148936986923, + -0.11555644869804382, + -0.13410548865795135, + -0.9166066646575928, + -0.5719056725502014, + 0.7563026547431946, + -0.21775959432125092, + -0.9722972512245178, + -0.38929200172424316, + -0.59339439868927, + -0.23656263947486877, + 0.7620325684547424, + -0.15014687180519104, + 0.7921885848045349 + ], + "type": "float32" + } + }, + { + "name": "sin float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 79.78058345331559, + 55.00573351892254, + -28.052533009972393, + -31.644301395318934, + 56.28375442556609, + -96.18512135074778, + -72.99826309079677, + -3.4241827262925852, + 84.02549499853444, + 5.030371842664394, + -9.512612392430725, + 9.540593026227612, + -25.267252298101056, + -20.831639431837345, + -32.024754770208745, + -55.69102662814118, + 15.92748126354438, + -57.8835344652012, + 31.0160642695962, + -94.88304659350737, + -84.58417183546084, + 44.848744233535655, + -19.000272686086987, + -48.03827737658466 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -0.946033775806427, + -0.9996118545532227, + -0.21998752653598785, + -0.22639396786689758, + -0.2618238627910614, + -0.9335716366767883, + 0.6754903197288513, + 0.27884384989738464, + 0.7156150341033936, + -0.9498680830001831, + 0.08772148936986923, + -0.11555644869804382, + -0.13410548865795135, + -0.9166066646575928, + -0.5719056725502014, + 0.7563026547431946, + -0.21775959432125092, + -0.9722972512245178, + -0.38929200172424316, + -0.59339439868927, + -0.23656263947486877, + 0.7620325684547424, + -0.15014687180519104, + 0.7921885848045349 + ], + "type": "float32" + } + }, + { + "name": "sin float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 79.78058345331559, + 55.00573351892254, + -28.052533009972393, + -31.644301395318934, + 56.28375442556609, + -96.18512135074778, + -72.99826309079677, + -3.4241827262925852, + 84.02549499853444, + 5.030371842664394, + -9.512612392430725, + 9.540593026227612, + -25.267252298101056, + -20.831639431837345, + -32.024754770208745, + -55.69102662814118, + 15.92748126354438, + -57.8835344652012, + 31.0160642695962, + -94.88304659350737, + -84.58417183546084, + 44.848744233535655, + -19.000272686086987, + -48.03827737658466 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.946033775806427, + -0.9996118545532227, + -0.21998752653598785, + -0.22639396786689758, + -0.2618238627910614, + -0.9335716366767883, + 0.6754903197288513, + 0.27884384989738464, + 0.7156150341033936, + -0.9498680830001831, + 0.08772148936986923, + -0.11555644869804382, + -0.13410548865795135, + -0.9166066646575928, + -0.5719056725502014, + 0.7563026547431946, + -0.21775959432125092, + -0.9722972512245178, + -0.38929200172424316, + -0.59339439868927, + -0.23656263947486877, + 0.7620325684547424, + -0.15014687180519104, + 0.7921885848045349 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/slice.json b/testing/web-platform/tests/webnn/resources/test_data/slice.json new file mode 100644 index 0000000000..ed193dd656 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/slice.json @@ -0,0 +1,254 @@ +{ + "tests": [ + { + "name": "slice float32 1D tensor", + "inputs": { + "input": { + "shape": [24], + "data": [ + 28.846251144212147, + 97.9541470229301, + -68.15961736262523, + 14.978987588557175, + 90.23090084798065, + 76.59095547712559, + -24.556316258204532, + 79.58749302462488, + 65.21375982234204, + 57.43970862960305, + 74.41775256222849, + -4.513182026141791, + 0.5424534704526991, + 80.44634130202977, + 28.327650022124686, + 74.0261938866893, + -74.54558964005362, + -27.30604081001799, + -70.4277433212161, + 59.82631931755259, + -58.46095416849133, + 79.80571087632629, + -9.857854207596304, + 42.66519880465225 + ], + "type": "float32" + } + }, + "starts": [12], + "sizes": [12], + "expected": { + "name": "output", + "shape": [12], + "data": [ + 0.5424534678459167, + 80.44634246826172, + 28.32765007019043, + 74.02619171142578, + -74.54559326171875, + -27.306041717529297, + -70.42774200439453, + 59.82632064819336, + -58.46095275878906, + 79.80570983886719, + -9.857853889465332, + 42.665199279785156 + ], + "type": "float32" + } + }, + { + "name": "slice float32 2D tensor", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 28.846251144212147, + 97.9541470229301, + -68.15961736262523, + 14.978987588557175, + 90.23090084798065, + 76.59095547712559, + -24.556316258204532, + 79.58749302462488, + 65.21375982234204, + 57.43970862960305, + 74.41775256222849, + -4.513182026141791, + 0.5424534704526991, + 80.44634130202977, + 28.327650022124686, + 74.0261938866893, + -74.54558964005362, + -27.30604081001799, + -70.4277433212161, + 59.82631931755259, + -58.46095416849133, + 79.80571087632629, + -9.857854207596304, + 42.66519880465225 + ], + "type": "float32" + } + }, + "starts": [2, 2], + "sizes": [2, 4], + "expected": { + "name": "output", + "shape": [2, 4], + "data": [ + 28.32765007019043, + 74.02619171142578, + -74.54559326171875, + -27.306041717529297, + -58.46095275878906, + 79.80570983886719, + -9.857853889465332, + 42.665199279785156 + ], + "type": "float32" + } + }, + { + "name": "slice float32 3D tensor", + "inputs": { + "input": { + "shape": [4, 3, 2], + "data": [ + 28.846251144212147, + 97.9541470229301, + -68.15961736262523, + 14.978987588557175, + 90.23090084798065, + 76.59095547712559, + -24.556316258204532, + 79.58749302462488, + 65.21375982234204, + 57.43970862960305, + 74.41775256222849, + -4.513182026141791, + 0.5424534704526991, + 80.44634130202977, + 28.327650022124686, + 74.0261938866893, + -74.54558964005362, + -27.30604081001799, + -70.4277433212161, + 59.82631931755259, + -58.46095416849133, + 79.80571087632629, + -9.857854207596304, + 42.66519880465225 + ], + "type": "float32" + } + }, + "starts": [1, 1, 1], + "sizes": [3, 2, 1], + "expected": { + "name": "output", + "shape": [3, 2, 1], + "data": [ + 57.4397087097168, + -4.513182163238525, + 74.02619171142578, + -27.306041717529297, + 79.80570983886719, + 42.665199279785156 + ], + "type": "float32" + } + }, + { + "name": "slice float32 4D tensor", + "inputs": { + "input": { + "shape": [2, 2, 3, 2], + "data": [ + 28.846251144212147, + 97.9541470229301, + -68.15961736262523, + 14.978987588557175, + 90.23090084798065, + 76.59095547712559, + -24.556316258204532, + 79.58749302462488, + 65.21375982234204, + 57.43970862960305, + 74.41775256222849, + -4.513182026141791, + 0.5424534704526991, + 80.44634130202977, + 28.327650022124686, + 74.0261938866893, + -74.54558964005362, + -27.30604081001799, + -70.4277433212161, + 59.82631931755259, + -58.46095416849133, + 79.80571087632629, + -9.857854207596304, + 42.66519880465225 + ], + "type": "float32" + } + }, + "starts": [1, 0, 2, 1], + "sizes": [1, 2, 1, 1], + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + -27.306041717529297, + 42.665199279785156 + ], + "type": "float32" + } + }, + { + "name": "slice float32 5D tensor", + "inputs": { + "input": { + "shape": [2, 2, 3, 2, 1], + "data": [ + 28.846251144212147, + 97.9541470229301, + -68.15961736262523, + 14.978987588557175, + 90.23090084798065, + 76.59095547712559, + -24.556316258204532, + 79.58749302462488, + 65.21375982234204, + 57.43970862960305, + 74.41775256222849, + -4.513182026141791, + 0.5424534704526991, + 80.44634130202977, + 28.327650022124686, + 74.0261938866893, + -74.54558964005362, + -27.30604081001799, + -70.4277433212161, + 59.82631931755259, + -58.46095416849133, + 79.80571087632629, + -9.857854207596304, + 42.66519880465225 + ], + "type": "float32" + } + }, + "starts": [1, 0, 2, 1, 0], + "sizes": [1, 2, 1, 1, 1], + "expected": { + "name": "output", + "shape": [1, 2, 1, 1, 1], + "data": [ + -27.306041717529297, + 42.665199279785156 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/softmax.json b/testing/web-platform/tests/webnn/resources/test_data/softmax.json new file mode 100644 index 0000000000..52ea57c763 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/softmax.json @@ -0,0 +1,136 @@ +{ + "tests": [ + { + "name": "softmax float32 2D tensor all positive", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 7.903734730203054, + 6.358251623091922, + 4.833756774572475, + 9.579165187926348, + 0.21071856783621445, + 4.554958961778823, + 7.150174113718282, + 8.330297576341172, + 1.535985791562966, + 6.633619497318013, + 1.45393689965033, + 0.21341864769940821, + 5.257819475802503, + 8.1921378632378, + 8.161730206898543, + 2.8744343334015565, + 8.950733525100087, + 6.111632812590415, + 1.6371468489476149, + 0.2762612074523485, + 5.028227187056009, + 3.898326029997037, + 2.8967114227178836, + 6.8894703393234575 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.15068615972995758, + 0.03212761878967285, + 0.006995180621743202, + 0.8048291206359863, + 0.00006871300138300285, + 0.005293202120810747, + 0.2057899534702301, + 0.6698001027107239, + 0.0007502624066546559, + 0.1227685883641243, + 0.0006911618984304368, + 0.00019990770670119673, + 0.012398251332342625, + 0.23319464921951294, + 0.22621041536331177, + 0.0011435872875154018, + 0.4979347288608551, + 0.029118351638317108, + 0.004253828432410955, + 0.001090824487619102, + 0.12633030116558075, + 0.040812913328409195, + 0.014990009367465973, + 0.8125221133232117 + ], + "type": "float32" + } + }, + { + "name": "softmax float32 2D tensor all negative", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -3.3118434934513763, + -3.338954812269648, + -3.4102789638525355, + -6.697192980301335, + -7.896223320202411, + -3.3081689006635866, + -3.2309720485303473, + -4.315771351061817, + -9.311088112018716, + -3.9236627720798856, + -3.7807213277512064, + -6.034926915403203, + -3.9196677453714273, + -2.223484249593408, + -9.326531526135806, + -1.4882492282868132, + -6.302842393071306, + -5.531475594479687, + -1.8421411696525603, + -4.994808274460977, + -9.527291818875955, + -4.985682906583053, + -8.421041200931548, + -6.235629579015209 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.2546302080154419, + 0.24781952798366547, + 0.2307596504688263, + 0.008623254485428333, + 0.002599793951958418, + 0.2555675804615021, + 0.40352678298950195, + 0.13637976348400116, + 0.0009232329903170466, + 0.20185552537441254, + 0.23287305235862732, + 0.024441635236144066, + 0.0551743283867836, + 0.3008708655834198, + 0.0002474947541486472, + 0.6276082992553711, + 0.0050902292132377625, + 0.011008745059370995, + 0.9090295433998108, + 0.0388500951230526, + 0.00041779119055718184, + 0.039206232875585556, + 0.0012629841221496463, + 0.011233373545110226 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/softsign.json b/testing/web-platform/tests/webnn/resources/test_data/softsign.json new file mode 100644 index 0000000000..e3208b18ad --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/softsign.json @@ -0,0 +1,400 @@ +{ // softsign: The calculation follows the expression x / (1 + |x|). + "tests": [ + { + "name": "softsign positive float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 1.5834133593790956, + 4.0787189411490115, + 8.883356617490337, + 8.070860233252166, + 8.211773633019915, + 2.4554003891197818, + 0.653374178120758, + 7.866281154604682, + 3.1239552336192666, + 8.013792390668268, + 3.9409862749371283, + 1.8131727337833081, + 2.390676102273188, + 1.3359680092645565, + 9.416410839467265, + 0.44325690899325254, + 5.236662013213598, + 9.424242359034539, + 7.816190418459348, + 5.849185795081855, + 8.780370640491928, + 5.1205157788312246, + 7.1172223514005095, + 4.59910661262345 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.6129152178764343, + 0.8030999898910522, + 0.8988198041915894, + 0.8897568583488464, + 0.8914432525634766, + 0.7105979323387146, + 0.3951762318611145, + 0.8872131109237671, + 0.7575143575668335, + 0.8890588879585266, + 0.7976112365722656, + 0.6445294618606567, + 0.7050735354423523, + 0.5719119310379028, + 0.9039976596832275, + 0.30712267756462097, + 0.8396578431129456, + 0.9040697813034058, + 0.8865723013877869, + 0.8539972305297852, + 0.8977543711662292, + 0.8366150856018066, + 0.8768051266670227, + 0.8214001059532166 + ], + "type": "float32" + } + }, + { + "name": "softsign negative float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + -2.5978440095516913, + -0.4449555447737712, + -9.095475232407683, + -3.7480076975512873, + -1.3867289790255697, + -8.220328902868987, + -3.538342320320556, + -9.364588742025619, + -6.283252341501335, + -5.0020120266550006, + -8.245729151019969, + -3.775470497728266, + -4.087254829132392, + -7.3816760861585795, + -5.882921529710956, + -8.338910337100263, + -6.6015492897072185, + -4.491942000901396, + -3.524778486355298, + -4.439912258765581, + -5.2342625634221225, + -1.5911732471016933, + -9.106277545690418, + -8.523774275382141 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.7220557928085327, + -0.3079372048377991, + -0.9009457230567932, + -0.7893853783607483, + -0.5810165405273438, + -0.891543984413147, + -0.7796552181243896, + -0.9035176634788513, + -0.8626986742019653, + -0.8333892226219177, + -0.8918419480323792, + -0.7905965447425842, + -0.8034303188323975, + -0.8806921243667603, + -0.8547128438949585, + -0.8929211497306824, + -0.8684478402137756, + -0.8179150223731995, + -0.7789947390556335, + -0.8161734938621521, + -0.8395960927009583, + -0.6140744686126709, + -0.9010515809059143, + -0.894999623298645 + ], + "type": "float32" + } + }, + { + "name": "softsign float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -8.343496173533422, + -6.92015211612679, + 2.699638761922575, + -8.663104577031863, + -3.190534368785616, + 7.657887080586452, + 6.650215091182602, + 6.058011004380681, + 0.6634320403254037, + 5.805803683155526, + -0.32821124531446344, + 1.270430403469046, + -9.946119978610852, + 6.905375202832072, + -0.031071535439890496, + -3.9696409293645862, + 6.270823207970878, + -2.6392608577007914, + 3.051350503137261, + 7.42647683445869, + -8.454667518154086, + 7.135868292466057, + -4.9860941550065885, + -7.859615086397076 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.8929736614227295, + -0.8737397789955139, + 0.7297033667564392, + -0.8965135812759399, + -0.7613669633865356, + 0.8844983577728271, + 0.8692847490310669, + 0.8583170175552368, + 0.3988332748413086, + 0.8530665636062622, + -0.24710771441459656, + 0.5595548748970032, + -0.9086434245109558, + 0.8735038042068481, + -0.03013519011437893, + -0.798778235912323, + 0.8624640107154846, + -0.7252188920974731, + 0.7531687617301941, + 0.88132643699646, + -0.8942321538925171, + 0.8770874738693237, + -0.8329461812973022, + -0.8871282935142517 + ], + "type": "float32" + } + }, + { + "name": "softsign float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -8.343496173533422, + -6.92015211612679, + 2.699638761922575, + -8.663104577031863, + -3.190534368785616, + 7.657887080586452, + 6.650215091182602, + 6.058011004380681, + 0.6634320403254037, + 5.805803683155526, + -0.32821124531446344, + 1.270430403469046, + -9.946119978610852, + 6.905375202832072, + -0.031071535439890496, + -3.9696409293645862, + 6.270823207970878, + -2.6392608577007914, + 3.051350503137261, + 7.42647683445869, + -8.454667518154086, + 7.135868292466057, + -4.9860941550065885, + -7.859615086397076 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.8929736614227295, + -0.8737397789955139, + 0.7297033667564392, + -0.8965135812759399, + -0.7613669633865356, + 0.8844983577728271, + 0.8692847490310669, + 0.8583170175552368, + 0.3988332748413086, + 0.8530665636062622, + -0.24710771441459656, + 0.5595548748970032, + -0.9086434245109558, + 0.8735038042068481, + -0.03013519011437893, + -0.798778235912323, + 0.8624640107154846, + -0.7252188920974731, + 0.7531687617301941, + 0.88132643699646, + -0.8942321538925171, + 0.8770874738693237, + -0.8329461812973022, + -0.8871282935142517 + ], + "type": "float32" + } + }, + { + "name": "softsign float32 4D tensor", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -8.343496173533422, + -6.92015211612679, + 2.699638761922575, + -8.663104577031863, + -3.190534368785616, + 7.657887080586452, + 6.650215091182602, + 6.058011004380681, + 0.6634320403254037, + 5.805803683155526, + -0.32821124531446344, + 1.270430403469046, + -9.946119978610852, + 6.905375202832072, + -0.031071535439890496, + -3.9696409293645862, + 6.270823207970878, + -2.6392608577007914, + 3.051350503137261, + 7.42647683445869, + -8.454667518154086, + 7.135868292466057, + -4.9860941550065885, + -7.859615086397076 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + -0.8929736614227295, + -0.8737397789955139, + 0.7297033667564392, + -0.8965135812759399, + -0.7613669633865356, + 0.8844983577728271, + 0.8692847490310669, + 0.8583170175552368, + 0.3988332748413086, + 0.8530665636062622, + -0.24710771441459656, + 0.5595548748970032, + -0.9086434245109558, + 0.8735038042068481, + -0.03013519011437893, + -0.798778235912323, + 0.8624640107154846, + -0.7252188920974731, + 0.7531687617301941, + 0.88132643699646, + -0.8942321538925171, + 0.8770874738693237, + -0.8329461812973022, + -0.8871282935142517 + ], + "type": "float32" + } + }, + { + "name": "softsign float32 5D tensor", + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + -8.343496173533422, + -6.92015211612679, + 2.699638761922575, + -8.663104577031863, + -3.190534368785616, + 7.657887080586452, + 6.650215091182602, + 6.058011004380681, + 0.6634320403254037, + 5.805803683155526, + -0.32821124531446344, + 1.270430403469046, + -9.946119978610852, + 6.905375202832072, + -0.031071535439890496, + -3.9696409293645862, + 6.270823207970878, + -2.6392608577007914, + 3.051350503137261, + 7.42647683445869, + -8.454667518154086, + 7.135868292466057, + -4.9860941550065885, + -7.859615086397076 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + -0.8929736614227295, + -0.8737397789955139, + 0.7297033667564392, + -0.8965135812759399, + -0.7613669633865356, + 0.8844983577728271, + 0.8692847490310669, + 0.8583170175552368, + 0.3988332748413086, + 0.8530665636062622, + -0.24710771441459656, + 0.5595548748970032, + -0.9086434245109558, + 0.8735038042068481, + -0.03013519011437893, + -0.798778235912323, + 0.8624640107154846, + -0.7252188920974731, + 0.7531687617301941, + 0.88132643699646, + -0.8942321538925171, + 0.8770874738693237, + -0.8329461812973022, + -0.8871282935142517 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/split.json b/testing/web-platform/tests/webnn/resources/test_data/split.json new file mode 100644 index 0000000000..e4216003c0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/split.json @@ -0,0 +1,660 @@ +{ + "tests": [ + { + "name": "split float32 1D tensor number splits default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 3, + "expected": [ + { + "name": "output1", + "shape": [8], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [8], + "data": [ + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438, + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422 + ], + "type": "float32" + }, + { + "name": "output3", + "shape": [8], + "data": [ + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 2D tensor number splits default options", + "inputs": { + "input": { + "shape": [8, 3], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 2, + "expected": [ + { + "name": "output1", + "shape": [4, 3], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [4, 3], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 3D tensor number splits default options", + "inputs": { + "input": { + "shape": [4, 3, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 2, + "expected": [ + { + "name": "output1", + "shape": [2, 3, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [2, 3, 2], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 4D tensor number splits default options", + "inputs": { + "input": { + "shape": [12, 1, 1, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 4, + "expected": [ + { + "name": "output1", + "shape": [3, 1, 1, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [3, 1, 1, 2], + "data": [ + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output3", + "shape": [3, 1, 1, 2], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578 + ], + "type": "float32" + }, + { + "name": "output4", + "shape": [3, 1, 1, 2], + "data": [ + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 5D tensor number splits default options", + "inputs": { + "input": { + "shape": [6, 1, 1, 2, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 2, + "expected": [ + { + "name": "output1", + "shape": [3, 1, 1, 2, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [3, 1, 1, 2, 2], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 4D tensor array splits default options", + "inputs": { + "input": { + "shape": [12, 1, 1, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": [3, 3, 3, 3], + "expected": [ + { + "name": "output1", + "shape": [3, 1, 1, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [3, 1, 1, 2], + "data": [ + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output3", + "shape": [3, 1, 1, 2], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578 + ], + "type": "float32" + }, + { + "name": "output4", + "shape": [3, 1, 1, 2], + "data": [ + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 4D tensor number splits options.axis", + "inputs": { + "input": { + "shape": [12, 1, 1, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": 3, + "options": { + "axis": 0 + }, + "expected": [ + { + "name": "output1", + "shape": [4, 1, 1, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [4, 1, 1, 2], + "data": [ + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438, + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422 + ], + "type": "float32" + }, + { + "name": "output3", + "shape": [4, 1, 1, 2], + "data": [ + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + }, + { + "name": "split float32 5D tensor array splits options.axis", + "inputs": { + "input": { + "shape": [1, 1, 6, 2, 2], + "data": [ + -64.52057192772567, + -84.60513454654502, + -67.9928282139549, + -23.446074622313745, + -85.64383132426956, + 46.877522730892906, + -68.11224159891194, + 75.99607609082298, + -61.05668616435924, + -90.92643605408041, + 53.916621140775476, + 84.16269171442175, + -95.57494716023527, + -52.40757884637803, + -29.007187148127983, + 71.65495730084652, + 50.663572707062656, + 21.364581604631596, + -27.127241457105228, + 65.1489516233315, + -30.406812651567833, + -6.818390152438795, + 46.67362179020569, + -21.12453802903387 + ], + "type": "float32" + } + }, + "splits": [3, 3], + "options": { + "axis": 2 + }, + "expected": [ + { + "name": "output1", + "shape": [1, 1, 3, 2, 2], + "data": [ + -64.52056884765625, + -84.60513305664062, + -67.99282836914062, + -23.446075439453125, + -85.64382934570312, + 46.87752151489258, + -68.11224365234375, + 75.99607849121094, + -61.05668640136719, + -90.92643737792969, + 53.916622161865234, + 84.16268920898438 + ], + "type": "float32" + }, + { + "name": "output2", + "shape": [1, 1, 3, 2, 2], + "data": [ + -95.57494354248047, + -52.40757751464844, + -29.007186889648438, + 71.65496063232422, + 50.66357421875, + 21.364582061767578, + -27.127241134643555, + 65.1489486694336, + -30.40681266784668, + -6.818390369415283, + 46.673622131347656, + -21.12453842163086 + ], + "type": "float32" + } + ] + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/squeeze.json b/testing/web-platform/tests/webnn/resources/test_data/squeeze.json new file mode 100644 index 0000000000..88890fe870 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/squeeze.json @@ -0,0 +1,696 @@ +{ + "tests": [ + { + "name": "squeeze float32 2D tensor by eliminating one dimension default options", + "inputs": { + "input": { + "shape": [1, 24], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 3D tensor by eliminating one dimension default options", + "inputs": { + "input": { + "shape": [4, 1, 6], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 3D tensor by eliminating two dimensions default options", + "inputs": { + "input": { + "shape": [1, 24, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 4D tensor by eliminating two dimensions default options", + "inputs": { + "input": { + "shape": [1, 4, 1, 6], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 4D tensor by eliminating all dimensions default options", + "inputs": { + "input": { + "shape": [1, 1, 1, 1], + "data": [ + 19.404981030500302 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 19.40498161315918, + "type": "float32" + } + }, + { + "name": "squeeze float32 5D tensor by eliminating four dimensions default options", + "inputs": { + "input": { + "shape": [1, 1, 1, 24, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 2D tensor by eliminating one dimension options.axes", + "inputs": { + "input": { + "shape": [1, 24], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "options": { + "axes": [0] + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 3D tensor by eliminating two dimensions options.axes", + "inputs": { + "input": { + "shape": [24, 1, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 2] + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 4D tensor by eliminating two dimensions options.axes", + "inputs": { + "input": { + "shape": [1, 4, 6, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 3] + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 5D tensor by eliminating two dimensions options.axes", + "inputs": { + "input": { + "shape": [2, 1, 1, 12, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 2] + }, + "expected": { + "name": "output", + "shape": [2, 12, 1], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + }, + { + "name": "squeeze float32 5D tensor by eliminating four dimensions options.axes", + "inputs": { + "input": { + "shape": [1, 1, 1, 24, 1], + "data": [ + 1.1293665986622017, + -93.29325783541842, + -19.999887095191227, + 41.119214363429876, + 92.69352298075461, + -41.51937878962313, + -56.75228730395734, + 11.148093991767155, + 5.57540042674151, + 15.709176425437747, + 62.550443705517665, + -5.299276370816216, + -18.61525168224469, + -66.94721623021692, + 94.97520289870027, + -21.94004801967297, + 30.047636856615554, + 13.805134987122344, + -45.08670702769, + 76.90356276507339, + 46.96974979938284, + -86.58127045567055, + 31.645846897982068, + -67.96637618240129 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 1, 2, 4] + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.1293666362762451, + -93.29325866699219, + -19.999887466430664, + 41.11921310424805, + 92.69351959228516, + -41.519378662109375, + -56.752288818359375, + 11.148094177246094, + 5.575400352478027, + 15.709176063537598, + 62.550445556640625, + -5.299276351928711, + -18.615251541137695, + -66.94721984863281, + 94.97520446777344, + -21.940048217773438, + 30.047636032104492, + 13.805134773254395, + -45.086708068847656, + 76.903564453125, + 46.969749450683594, + -86.58126831054688, + 31.64584732055664, + -67.96637725830078 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/sub.json b/testing/web-platform/tests/webnn/resources/test_data/sub.json new file mode 100644 index 0000000000..4a3096313e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sub.json @@ -0,0 +1,784 @@ +{ + "tests": [ + { + "name": "sub float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -49.12813049327167, + 40.189291278955295, + 7.224666637037913, + 89.26004842468907, + -81.43340528622471, + 59.61165817521396, + 11.234410659855328, + 48.884057695505845, + 85.26825586730342, + 27.6952967767901, + 30.989454126839945, + -38.1290365096719, + -83.14809826804765, + -86.16174952283208, + 16.758884614336495, + 46.128898841129086, + -28.432477462364687, + 28.229338368319986, + 35.23646170623519, + -77.05516625176658, + -57.8714723086966, + -58.15086093387936, + 27.48886675763096, + 31.998020251913943 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [24], + "data": [ + 122.72087097167969, + -25.704608917236328, + -76.62667846679688, + -141.30532836914062, + 5.652030944824219, + -61.885711669921875, + -94.53349304199219, + -33.3062858581543, + -147.96905517578125, + 5.258705139160156, + 51.56763458251953, + -36.77735137939453, + 161.37109375, + 134.5541534423828, + -35.91242599487305, + -132.0611114501953, + 117.5560302734375, + -5.354707717895508, + 45.33327102661133, + 174.68115234375, + 110.61997985839844, + 147.31689453125, + -47.992286682128906, + 67.48905944824219 + ], + "type": "float32" + } + }, + { + "name": "sub float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -49.12813049327167, + 40.189291278955295, + 7.224666637037913, + 89.26004842468907, + -81.43340528622471, + 59.61165817521396, + 11.234410659855328, + 48.884057695505845, + 85.26825586730342, + 27.6952967767901, + 30.989454126839945, + -38.1290365096719, + -83.14809826804765, + -86.16174952283208, + 16.758884614336495, + 46.128898841129086, + -28.432477462364687, + 28.229338368319986, + 35.23646170623519, + -77.05516625176658, + -57.8714723086966, + -58.15086093387936, + 27.48886675763096, + 31.998020251913943 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [4, 6], + "data": [ + 122.72087097167969, + -25.704608917236328, + -76.62667846679688, + -141.30532836914062, + 5.652030944824219, + -61.885711669921875, + -94.53349304199219, + -33.3062858581543, + -147.96905517578125, + 5.258705139160156, + 51.56763458251953, + -36.77735137939453, + 161.37109375, + 134.5541534423828, + -35.91242599487305, + -132.0611114501953, + 117.5560302734375, + -5.354707717895508, + 45.33327102661133, + 174.68115234375, + 110.61997985839844, + 147.31689453125, + -47.992286682128906, + 67.48905944824219 + ], + "type": "float32" + } + }, + { + "name": "sub float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -49.12813049327167, + 40.189291278955295, + 7.224666637037913, + 89.26004842468907, + -81.43340528622471, + 59.61165817521396, + 11.234410659855328, + 48.884057695505845, + 85.26825586730342, + 27.6952967767901, + 30.989454126839945, + -38.1290365096719, + -83.14809826804765, + -86.16174952283208, + 16.758884614336495, + 46.128898841129086, + -28.432477462364687, + 28.229338368319986, + 35.23646170623519, + -77.05516625176658, + -57.8714723086966, + -58.15086093387936, + 27.48886675763096, + 31.998020251913943 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 3, 4], + "data": [ + 122.72087097167969, + -25.704608917236328, + -76.62667846679688, + -141.30532836914062, + 5.652030944824219, + -61.885711669921875, + -94.53349304199219, + -33.3062858581543, + -147.96905517578125, + 5.258705139160156, + 51.56763458251953, + -36.77735137939453, + 161.37109375, + 134.5541534423828, + -35.91242599487305, + -132.0611114501953, + 117.5560302734375, + -5.354707717895508, + 45.33327102661133, + 174.68115234375, + 110.61997985839844, + 147.31689453125, + -47.992286682128906, + 67.48905944824219 + ], + "type": "float32" + } + }, + { + "name": "sub float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -49.12813049327167, + 40.189291278955295, + 7.224666637037913, + 89.26004842468907, + -81.43340528622471, + 59.61165817521396, + 11.234410659855328, + 48.884057695505845, + 85.26825586730342, + 27.6952967767901, + 30.989454126839945, + -38.1290365096719, + -83.14809826804765, + -86.16174952283208, + 16.758884614336495, + 46.128898841129086, + -28.432477462364687, + 28.229338368319986, + 35.23646170623519, + -77.05516625176658, + -57.8714723086966, + -58.15086093387936, + 27.48886675763096, + 31.998020251913943 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 122.72087097167969, + -25.704608917236328, + -76.62667846679688, + -141.30532836914062, + 5.652030944824219, + -61.885711669921875, + -94.53349304199219, + -33.3062858581543, + -147.96905517578125, + 5.258705139160156, + 51.56763458251953, + -36.77735137939453, + 161.37109375, + 134.5541534423828, + -35.91242599487305, + -132.0611114501953, + 117.5560302734375, + -5.354707717895508, + 45.33327102661133, + 174.68115234375, + 110.61997985839844, + 147.31689453125, + -47.992286682128906, + 67.48905944824219 + ], + "type": "float32" + } + }, + { + "name": "sub float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -49.12813049327167, + 40.189291278955295, + 7.224666637037913, + 89.26004842468907, + -81.43340528622471, + 59.61165817521396, + 11.234410659855328, + 48.884057695505845, + 85.26825586730342, + 27.6952967767901, + 30.989454126839945, + -38.1290365096719, + -83.14809826804765, + -86.16174952283208, + 16.758884614336495, + 46.128898841129086, + -28.432477462364687, + 28.229338368319986, + 35.23646170623519, + -77.05516625176658, + -57.8714723086966, + -58.15086093387936, + 27.48886675763096, + 31.998020251913943 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 1, 2, 3], + "data": [ + 122.72087097167969, + -25.704608917236328, + -76.62667846679688, + -141.30532836914062, + 5.652030944824219, + -61.885711669921875, + -94.53349304199219, + -33.3062858581543, + -147.96905517578125, + 5.258705139160156, + 51.56763458251953, + -36.77735137939453, + 161.37109375, + 134.5541534423828, + -35.91242599487305, + -132.0611114501953, + 117.5560302734375, + -5.354707717895508, + 45.33327102661133, + 174.68115234375, + 110.61997985839844, + 147.31689453125, + -47.992286682128906, + 67.48905944824219 + ], + "type": "float32" + } + }, + { + "name": "sub float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + -97.04911633292723 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -170.641845703125, + -111.53379821777344, + -27.64710235595703, + -45.00383377075195, + -21.267745971679688, + -94.77507019042969, + -13.750038146972656, + -112.62688446044922, + -34.34831237792969, + -130.00311279296875, + -179.606201171875, + -22.142730712890625, + -175.27210998535156, + -145.4415283203125, + -77.89557647705078, + -11.116905212402344, + -186.17266845703125, + -119.92375183105469, + -177.6188507080078, + -194.67510986328125, + -149.79762268066406, + -186.21514892578125, + -76.54570007324219, + -196.53619384765625 + ], + "type": "float32" + } + }, + { + "name": "sub float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + 10.76283817728796, + -90.23991799972681, + 12.787367580497303, + -62.44633978281189, + 32.182575156356904, + 20.35949259849579 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 62.82989501953125, + 104.72460174560547, + -82.18938446044922, + 10.401054382324219, + -107.96394348144531, + -22.633544921875, + -94.06192016601562, + 105.81768798828125, + -75.48817443847656, + 95.40034484863281, + 50.374515533447266, + -95.26588439941406, + 67.46015167236328, + 138.63232421875, + -31.94091033935547, + -23.48587417602539, + 56.940975189208984, + 2.51513671875, + 69.80689239501953, + 187.86590576171875, + 39.96113967895508, + 151.6123809814453, + -52.68599319458008, + 79.12757873535156 + ], + "type": "float32" + } + }, + { + "name": "sub float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -8.393114200101877, + 75.54752975621165, + -32.32586947927443, + 8.088332085081447 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + 81.98584747314453, + 22.877796173095703, + -61.00890350341797, + -127.59281921386719, + -151.3289031982422, + -77.82157897949219, + -50.973209381103516, + 47.90364074707031, + -30.374935150146484, + 24.86566925048828, + 74.46875762939453, + -82.99472045898438, + 86.61610412597656, + 56.78551483154297, + -10.760427474975586, + -161.479736328125, + 13.576019287109375, + -52.67290115356445, + 112.89559936523438, + 129.9518585205078, + 85.07437896728516, + 81.07770538330078, + -28.591751098632812, + 91.39874267578125 + ], + "type": "float32" + } + }, + { + "name": "sub float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + -97.04911633292723 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 73.59273411765761, + 14.484682970108636, + -69.40201711151408, + -52.04528488626416, + -75.78136877111933, + -2.274051445061204, + -83.29907743841476, + 15.57776886289956, + -62.70080421291606, + 32.95400351079056, + 82.55709225645836, + -74.90638758877455, + 78.22299428029646, + 48.39240254947623, + -19.153541450651716, + -85.93221227232242, + 89.12354776921964, + 22.874629248059804, + 80.56973297595874, + 97.62598337281631, + 52.74850952689357, + 89.16604046945432, + -20.503417738603375, + 99.48707602133317 + ], + "type": "float32" + } + }, + "expected": { + "name": "ouput", + "shape": [2, 2, 2, 3], + "data": [ + -170.641845703125, + -111.53379821777344, + -27.64710235595703, + -45.00383377075195, + -21.267745971679688, + -94.77507019042969, + -13.750038146972656, + -112.62688446044922, + -34.34831237792969, + -130.00311279296875, + -179.606201171875, + -22.142730712890625, + -175.27210998535156, + -145.4415283203125, + -77.89557647705078, + -11.116905212402344, + -186.17266845703125, + -119.92375183105469, + -177.6188507080078, + -194.67510986328125, + -149.79762268066406, + -186.21514892578125, + -76.54570007324219, + -196.53619384765625 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/tan.json b/testing/web-platform/tests/webnn/resources/test_data/tan.json new file mode 100644 index 0000000000..857e2b6505 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/tan.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "tan float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 52.697813799029234, + 70.06912795961244, + 90.49689556206596, + 24.656670346007246, + 11.665126934214868, + -50.95264467861913, + 40.32006298292501, + -9.641122915742358, + -31.567750159821898, + 45.59520766037491, + -55.93085683516472, + -44.602971816473726, + 80.45398224930159, + -2.314880760077372, + -25.474768449753242, + 62.589453387873476, + -70.9440311153533, + 62.8486191264619, + 84.79767085874772, + -95.58503093501218, + 15.552484501850643, + -55.256541162343574, + -26.884890419121504, + 0.15926108746810996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.8582430481910706, + 1.410544753074646, + -0.6978657245635986, + -0.5156278610229492, + -1.2633823156356812, + -0.8205758929252625, + -0.5734118819236755, + -0.21978461742401123, + -0.1530018001794815, + -23.731182098388672, + 0.7106066942214966, + -0.7149254679679871, + -2.7969717979431152, + 1.086239218711853, + -0.3560185432434082, + -0.24726025760173798, + 3.7865755558013916, + 0.016766052693128586, + -0.025338610634207726, + -4.203672409057617, + -0.1567438244819641, + 3.495089292526245, + 5.453553199768066, + 0.16062140464782715 + ], + "type": "float32" + } + }, + { + "name": "tan float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 52.697813799029234, + 70.06912795961244, + 90.49689556206596, + 24.656670346007246, + 11.665126934214868, + -50.95264467861913, + 40.32006298292501, + -9.641122915742358, + -31.567750159821898, + 45.59520766037491, + -55.93085683516472, + -44.602971816473726, + 80.45398224930159, + -2.314880760077372, + -25.474768449753242, + 62.589453387873476, + -70.9440311153533, + 62.8486191264619, + 84.79767085874772, + -95.58503093501218, + 15.552484501850643, + -55.256541162343574, + -26.884890419121504, + 0.15926108746810996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.8582430481910706, + 1.410544753074646, + -0.6978657245635986, + -0.5156278610229492, + -1.2633823156356812, + -0.8205758929252625, + -0.5734118819236755, + -0.21978461742401123, + -0.1530018001794815, + -23.731182098388672, + 0.7106066942214966, + -0.7149254679679871, + -2.7969717979431152, + 1.086239218711853, + -0.3560185432434082, + -0.24726025760173798, + 3.7865755558013916, + 0.016766052693128586, + -0.025338610634207726, + -4.203672409057617, + -0.1567438244819641, + 3.495089292526245, + 5.453553199768066, + 0.16062140464782715 + ], + "type": "float32" + } + }, + { + "name": "tan float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 52.697813799029234, + 70.06912795961244, + 90.49689556206596, + 24.656670346007246, + 11.665126934214868, + -50.95264467861913, + 40.32006298292501, + -9.641122915742358, + -31.567750159821898, + 45.59520766037491, + -55.93085683516472, + -44.602971816473726, + 80.45398224930159, + -2.314880760077372, + -25.474768449753242, + 62.589453387873476, + -70.9440311153533, + 62.8486191264619, + 84.79767085874772, + -95.58503093501218, + 15.552484501850643, + -55.256541162343574, + -26.884890419121504, + 0.15926108746810996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.8582430481910706, + 1.410544753074646, + -0.6978657245635986, + -0.5156278610229492, + -1.2633823156356812, + -0.8205758929252625, + -0.5734118819236755, + -0.21978461742401123, + -0.1530018001794815, + -23.731182098388672, + 0.7106066942214966, + -0.7149254679679871, + -2.7969717979431152, + 1.086239218711853, + -0.3560185432434082, + -0.24726025760173798, + 3.7865755558013916, + 0.016766052693128586, + -0.025338610634207726, + -4.203672409057617, + -0.1567438244819641, + 3.495089292526245, + 5.453553199768066, + 0.16062140464782715 + ], + "type": "float32" + } + }, + { + "name": "tan float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 52.697813799029234, + 70.06912795961244, + 90.49689556206596, + 24.656670346007246, + 11.665126934214868, + -50.95264467861913, + 40.32006298292501, + -9.641122915742358, + -31.567750159821898, + 45.59520766037491, + -55.93085683516472, + -44.602971816473726, + 80.45398224930159, + -2.314880760077372, + -25.474768449753242, + 62.589453387873476, + -70.9440311153533, + 62.8486191264619, + 84.79767085874772, + -95.58503093501218, + 15.552484501850643, + -55.256541162343574, + -26.884890419121504, + 0.15926108746810996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -0.8582430481910706, + 1.410544753074646, + -0.6978657245635986, + -0.5156278610229492, + -1.2633823156356812, + -0.8205758929252625, + -0.5734118819236755, + -0.21978461742401123, + -0.1530018001794815, + -23.731182098388672, + 0.7106066942214966, + -0.7149254679679871, + -2.7969717979431152, + 1.086239218711853, + -0.3560185432434082, + -0.24726025760173798, + 3.7865755558013916, + 0.016766052693128586, + -0.025338610634207726, + -4.203672409057617, + -0.1567438244819641, + 3.495089292526245, + 5.453553199768066, + 0.16062140464782715 + ], + "type": "float32" + } + }, + { + "name": "tan float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 52.697813799029234, + 70.06912795961244, + 90.49689556206596, + 24.656670346007246, + 11.665126934214868, + -50.95264467861913, + 40.32006298292501, + -9.641122915742358, + -31.567750159821898, + 45.59520766037491, + -55.93085683516472, + -44.602971816473726, + 80.45398224930159, + -2.314880760077372, + -25.474768449753242, + 62.589453387873476, + -70.9440311153533, + 62.8486191264619, + 84.79767085874772, + -95.58503093501218, + 15.552484501850643, + -55.256541162343574, + -26.884890419121504, + 0.15926108746810996 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.8582430481910706, + 1.410544753074646, + -0.6978657245635986, + -0.5156278610229492, + -1.2633823156356812, + -0.8205758929252625, + -0.5734118819236755, + -0.21978461742401123, + -0.1530018001794815, + -23.731182098388672, + 0.7106066942214966, + -0.7149254679679871, + -2.7969717979431152, + 1.086239218711853, + -0.3560185432434082, + -0.24726025760173798, + 3.7865755558013916, + 0.016766052693128586, + -0.025338610634207726, + -4.203672409057617, + -0.1567438244819641, + 3.495089292526245, + 5.453553199768066, + 0.16062140464782715 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/tanh.json b/testing/web-platform/tests/webnn/resources/test_data/tanh.json new file mode 100644 index 0000000000..9e13b62472 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/tanh.json @@ -0,0 +1,334 @@ +{ + "tests": [ + { + "name": "tanh float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 5.47352732138576, + -1.1535596038683664, + 0.4074455820170506, + 1.8297704953674545, + 2.8690003001236537, + -4.570195171586943, + 4.146744465978713, + -4.0659342722666105, + -3.712847102459686, + 0.9077175268859179, + -0.11083049583219662, + 5.955096345162751, + 1.7831856867406417, + 4.023128342782897, + 5.587857512324163, + -5.280654174784587, + 1.4147950164785632, + -5.707717050109768, + -1.4439182665473629, + -1.9129082844854288, + 2.7495969049667437, + -0.7420240173058836, + 4.856568111647942, + -0.7563357776241926 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.9999647736549377, + -0.8189298510551453, + 0.38630160689353943, + 0.9498035907745361, + 0.9935782551765442, + -0.9997855424880981, + 0.9994998574256897, + -0.9994121193885803, + -0.9988092184066772, + 0.7200349569320679, + -0.1103789210319519, + 0.9999865293502808, + 0.945036768913269, + 0.9993596076965332, + 0.9999719858169556, + -0.9999482035636902, + 0.8885080814361572, + -0.9999779462814331, + -0.894483745098114, + -0.9573289752006531, + 0.9918531775474548, + -0.6303664445877075, + 0.9998790621757507, + -0.6389135718345642 + ], + "type": "float32" + } + }, + { + "name": "tanh float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 5.47352732138576, + -1.1535596038683664, + 0.4074455820170506, + 1.8297704953674545, + 2.8690003001236537, + -4.570195171586943, + 4.146744465978713, + -4.0659342722666105, + -3.712847102459686, + 0.9077175268859179, + -0.11083049583219662, + 5.955096345162751, + 1.7831856867406417, + 4.023128342782897, + 5.587857512324163, + -5.280654174784587, + 1.4147950164785632, + -5.707717050109768, + -1.4439182665473629, + -1.9129082844854288, + 2.7495969049667437, + -0.7420240173058836, + 4.856568111647942, + -0.7563357776241926 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.9999647736549377, + -0.8189298510551453, + 0.38630160689353943, + 0.9498035907745361, + 0.9935782551765442, + -0.9997855424880981, + 0.9994998574256897, + -0.9994121193885803, + -0.9988092184066772, + 0.7200349569320679, + -0.1103789210319519, + 0.9999865293502808, + 0.945036768913269, + 0.9993596076965332, + 0.9999719858169556, + -0.9999482035636902, + 0.8885080814361572, + -0.9999779462814331, + -0.894483745098114, + -0.9573289752006531, + 0.9918531775474548, + -0.6303664445877075, + 0.9998790621757507, + -0.6389135718345642 + ], + "type": "float32" + } + }, + { + "name": "tanh float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 5.47352732138576, + -1.1535596038683664, + 0.4074455820170506, + 1.8297704953674545, + 2.8690003001236537, + -4.570195171586943, + 4.146744465978713, + -4.0659342722666105, + -3.712847102459686, + 0.9077175268859179, + -0.11083049583219662, + 5.955096345162751, + 1.7831856867406417, + 4.023128342782897, + 5.587857512324163, + -5.280654174784587, + 1.4147950164785632, + -5.707717050109768, + -1.4439182665473629, + -1.9129082844854288, + 2.7495969049667437, + -0.7420240173058836, + 4.856568111647942, + -0.7563357776241926 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0.9999647736549377, + -0.8189298510551453, + 0.38630160689353943, + 0.9498035907745361, + 0.9935782551765442, + -0.9997855424880981, + 0.9994998574256897, + -0.9994121193885803, + -0.9988092184066772, + 0.7200349569320679, + -0.1103789210319519, + 0.9999865293502808, + 0.945036768913269, + 0.9993596076965332, + 0.9999719858169556, + -0.9999482035636902, + 0.8885080814361572, + -0.9999779462814331, + -0.894483745098114, + -0.9573289752006531, + 0.9918531775474548, + -0.6303664445877075, + 0.9998790621757507, + -0.6389135718345642 + ], + "type": "float32" + } + }, + { + "name": "tanh float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 5.47352732138576, + -1.1535596038683664, + 0.4074455820170506, + 1.8297704953674545, + 2.8690003001236537, + -4.570195171586943, + 4.146744465978713, + -4.0659342722666105, + -3.712847102459686, + 0.9077175268859179, + -0.11083049583219662, + 5.955096345162751, + 1.7831856867406417, + 4.023128342782897, + 5.587857512324163, + -5.280654174784587, + 1.4147950164785632, + -5.707717050109768, + -1.4439182665473629, + -1.9129082844854288, + 2.7495969049667437, + -0.7420240173058836, + 4.856568111647942, + -0.7563357776241926 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.9999647736549377, + -0.8189298510551453, + 0.38630160689353943, + 0.9498035907745361, + 0.9935782551765442, + -0.9997855424880981, + 0.9994998574256897, + -0.9994121193885803, + -0.9988092184066772, + 0.7200349569320679, + -0.1103789210319519, + 0.9999865293502808, + 0.945036768913269, + 0.9993596076965332, + 0.9999719858169556, + -0.9999482035636902, + 0.8885080814361572, + -0.9999779462814331, + -0.894483745098114, + -0.9573289752006531, + 0.9918531775474548, + -0.6303664445877075, + 0.9998790621757507, + -0.6389135718345642 + ], + "type": "float32" + } + }, + { + "name": "tanh float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 5.47352732138576, + -1.1535596038683664, + 0.4074455820170506, + 1.8297704953674545, + 2.8690003001236537, + -4.570195171586943, + 4.146744465978713, + -4.0659342722666105, + -3.712847102459686, + 0.9077175268859179, + -0.11083049583219662, + 5.955096345162751, + 1.7831856867406417, + 4.023128342782897, + 5.587857512324163, + -5.280654174784587, + 1.4147950164785632, + -5.707717050109768, + -1.4439182665473629, + -1.9129082844854288, + 2.7495969049667437, + -0.7420240173058836, + 4.856568111647942, + -0.7563357776241926 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.9999647736549377, + -0.8189298510551453, + 0.38630160689353943, + 0.9498035907745361, + 0.9935782551765442, + -0.9997855424880981, + 0.9994998574256897, + -0.9994121193885803, + -0.9988092184066772, + 0.7200349569320679, + -0.1103789210319519, + 0.9999865293502808, + 0.945036768913269, + 0.9993596076965332, + 0.9999719858169556, + -0.9999482035636902, + 0.8885080814361572, + -0.9999779462814331, + -0.894483745098114, + -0.9573289752006531, + 0.9918531775474548, + -0.6303664445877075, + 0.9998790621757507, + -0.6389135718345642 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/transpose.json b/testing/web-platform/tests/webnn/resources/test_data/transpose.json new file mode 100644 index 0000000000..03092031d9 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/transpose.json @@ -0,0 +1,679 @@ +{ + "tests": [ + { + "name": "transpose float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -45.67443084716797, + 53.45924758911133, + -60.118492126464844, + 38.081748962402344, + 78.64247131347656, + -69.25324249267578, + 1.8434585332870483, + 92.8102798461914, + 56.100074768066406, + 77.05838012695312, + 57.46807861328125, + -84.74308776855469, + 46.38539123535156, + -84.89764404296875, + 56.70438766479492, + -25.695144653320312, + 5.62217378616333, + -25.66281509399414, + 99.46284484863281, + -87.58920288085938, + -65.3779067993164, + -66.00990295410156, + 38.466827392578125, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [6, 4], + "data": [ + -45.67443084716797, + 1.8434585332870483, + 46.38539123535156, + 99.46284484863281, + 53.45924758911133, + 92.8102798461914, + -84.89764404296875, + -87.58920288085938, + -60.118492126464844, + 56.100074768066406, + 56.70438766479492, + -65.3779067993164, + 38.081748962402344, + 77.05838012695312, + -25.695144653320312, + -66.00990295410156, + 78.64247131347656, + 57.46807861328125, + 5.62217378616333, + 38.466827392578125, + -69.25324249267578, + -84.74308776855469, + -25.66281509399414, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 3, 2], + "data": [ + -45.67443084716797, + 46.38539123535156, + 78.64247131347656, + 5.62217378616333, + 56.100074768066406, + -65.3779067993164, + 53.45924758911133, + -84.89764404296875, + -69.25324249267578, + -25.66281509399414, + 77.05838012695312, + -66.00990295410156, + -60.118492126464844, + 56.70438766479492, + 1.8434585332870483, + 99.46284484863281, + 57.46807861328125, + 38.466827392578125, + 38.081748962402344, + -25.695144653320312, + 92.8102798461914, + -87.58920288085938, + -84.74308776855469, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 4D tensor default options", + "inputs": { + "input": { + "shape": [1, 2, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 3, 2, 1], + "data": [ + -45.67443084716797, + 46.38539123535156, + 78.64247131347656, + 5.62217378616333, + 56.100074768066406, + -65.3779067993164, + 53.45924758911133, + -84.89764404296875, + -69.25324249267578, + -25.66281509399414, + 77.05838012695312, + -66.00990295410156, + -60.118492126464844, + 56.70438766479492, + 1.8434585332870483, + 99.46284484863281, + 57.46807861328125, + 38.466827392578125, + 38.081748962402344, + -25.695144653320312, + 92.8102798461914, + -87.58920288085938, + -84.74308776855469, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 5D tensor default options", + "inputs": { + "input": { + "shape": [1, 2, 1, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 3, 1, 2, 1], + "data": [ + -45.67443084716797, + 46.38539123535156, + 78.64247131347656, + 5.62217378616333, + 56.100074768066406, + -65.3779067993164, + 53.45924758911133, + -84.89764404296875, + -69.25324249267578, + -25.66281509399414, + 77.05838012695312, + -66.00990295410156, + -60.118492126464844, + 56.70438766479492, + 1.8434585332870483, + 99.46284484863281, + 57.46807861328125, + 38.466827392578125, + 38.081748962402344, + -25.695144653320312, + 92.8102798461914, + -87.58920288085938, + -84.74308776855469, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 1D tensor options.permutation", + "inputs": { + "input": { + "shape": [24], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "options": { + "permutation": [0] + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -45.67443084716797, + 53.45924758911133, + -60.118492126464844, + 38.081748962402344, + 78.64247131347656, + -69.25324249267578, + 1.8434585332870483, + 92.8102798461914, + 56.100074768066406, + 77.05838012695312, + 57.46807861328125, + -84.74308776855469, + 46.38539123535156, + -84.89764404296875, + 56.70438766479492, + -25.695144653320312, + 5.62217378616333, + -25.66281509399414, + 99.46284484863281, + -87.58920288085938, + -65.3779067993164, + -66.00990295410156, + 38.466827392578125, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 2D tensor options.permutation", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "options": { + "permutation": [1, 0] + }, + "expected": { + "name": "output", + "shape": [6, 4], + "data": [ + -45.67443084716797, + 1.8434585332870483, + 46.38539123535156, + 99.46284484863281, + 53.45924758911133, + 92.8102798461914, + -84.89764404296875, + -87.58920288085938, + -60.118492126464844, + 56.100074768066406, + 56.70438766479492, + -65.3779067993164, + 38.081748962402344, + 77.05838012695312, + -25.695144653320312, + -66.00990295410156, + 78.64247131347656, + 57.46807861328125, + 5.62217378616333, + 38.466827392578125, + -69.25324249267578, + -84.74308776855469, + -25.66281509399414, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 3D tensor options.permutation", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "options": { + "permutation": [2, 0, 1] + }, + "expected": { + "name": "output", + "shape": [4, 2, 3], + "data": [ + -45.67443084716797, + 78.64247131347656, + 56.100074768066406, + 46.38539123535156, + 5.62217378616333, + -65.3779067993164, + 53.45924758911133, + -69.25324249267578, + 77.05838012695312, + -84.89764404296875, + -25.66281509399414, + -66.00990295410156, + -60.118492126464844, + 1.8434585332870483, + 57.46807861328125, + 56.70438766479492, + 99.46284484863281, + 38.466827392578125, + 38.081748962402344, + 92.8102798461914, + -84.74308776855469, + -25.695144653320312, + -87.58920288085938, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 4D tensor options.permutation", + "inputs": { + "input": { + "shape": [1, 2, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "options": { + "permutation": [2, 3, 0, 1] + }, + "expected": { + "name": "output", + "shape": [3, 4, 1, 2], + "data": [ + -45.67443084716797, + 46.38539123535156, + 53.45924758911133, + -84.89764404296875, + -60.118492126464844, + 56.70438766479492, + 38.081748962402344, + -25.695144653320312, + 78.64247131347656, + 5.62217378616333, + -69.25324249267578, + -25.66281509399414, + 1.8434585332870483, + 99.46284484863281, + 92.8102798461914, + -87.58920288085938, + 56.100074768066406, + -65.3779067993164, + 77.05838012695312, + -66.00990295410156, + 57.46807861328125, + 38.466827392578125, + -84.74308776855469, + 2.1999382972717285 + ], + "type": "float32" + } + }, + { + "name": "transpose float32 5D tensor options.permutation", + "inputs": { + "input": { + "shape": [1, 2, 1, 3, 4], + "data": [ + -45.67443169971317, + 53.45924798828125, + -60.118491676622114, + 38.08174802652866, + 78.64247328659363, + -69.2532431989057, + 1.843458570865181, + 92.81028097440239, + 56.10007526080264, + 77.05838267016932, + 57.46807874077655, + -84.74308916696364, + 46.38539267170415, + -84.89764374240352, + 56.70438712681607, + -25.69514467758806, + 5.622173913750174, + -25.6628149156966, + 99.46284660658401, + -87.58919988335086, + -65.37790624507953, + -66.00990219021253, + 38.46682821671709, + 2.1999381880991393 + ], + "type": "float32" + } + }, + "options": { + "permutation": [1, 3, 0, 4, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3, 1, 4, 1], + "data": [ + -45.67443084716797, + 53.45924758911133, + -60.118492126464844, + 38.081748962402344, + 78.64247131347656, + -69.25324249267578, + 1.8434585332870483, + 92.8102798461914, + 56.100074768066406, + 77.05838012695312, + 57.46807861328125, + -84.74308776855469, + 46.38539123535156, + -84.89764404296875, + 56.70438766479492, + -25.695144653320312, + 5.62217378616333, + -25.66281509399414, + 99.46284484863281, + -87.58920288085938, + -65.3779067993164, + -66.00990295410156, + 38.466827392578125, + 2.1999382972717285 + ], + "type": "float32" + } + } + ] +}
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/utils.js b/testing/web-platform/tests/webnn/resources/utils.js new file mode 100644 index 0000000000..37748fd57a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/utils.js @@ -0,0 +1,664 @@ +'use strict'; + +const ExecutionArray = ['sync', 'async']; + +// https://webmachinelearning.github.io/webnn/#enumdef-mloperandtype +const TypedArrayDict = { + float32: Float32Array, + int32: Int32Array, + uint32: Uint32Array, + int8: Int8Array, + uint8: Uint8Array, +}; + +const sizeOfShape = (array) => { + return array.reduce((accumulator, currentValue) => accumulator * currentValue, 1); +}; + +/** + * Get tests resources from test data JSON file of specified operation name. + * @param {String} operationName - An operation name + * @returns {Object} Tests resources + */ +const loadTests = (operationName) => { + const loadJSON = (file) => { + let xmlhttp = new XMLHttpRequest(); + xmlhttp.open("GET", file, false); + xmlhttp.overrideMimeType("application/json"); + xmlhttp.send(); + if (xmlhttp.status == 200 && xmlhttp.readyState == 4) { + return xmlhttp.responseText; + } else { + throw new Error(`Failed to load ${file}`); + } + }; + + const capitalLetterMatches = operationName.match(/[A-Z]/g); + if (capitalLetterMatches !== null) { + // for example: the test data JSON file for leakyRelu is leaky_relu.json and for reduceLogSum is reduce_log_sum.json + capitalLetterMatches.forEach( + capitalLetter => operationName = operationName.replace(capitalLetter, `_${capitalLetter.toLowerCase()}`) + ) + } + const json = loadJSON(`/webnn/resources/test_data/${operationName}.json`); + const resources = JSON.parse(json.replace(/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g, (m, g) => g ? "" : m)); + return resources.tests; +}; + +/** + * Get exptected data and data type from given resources with output name. + * @param {Array} resources - An array of expected resources + * @param {String} outputName - An output name + * @returns {Array.<[Number[], String]>} An array of expected data array and data type + */ +const getExpectedDataAndType = (resources, outputName) => { + let ret; + for (let subResources of resources) { + if (subResources.name === outputName) { + ret = [subResources.data, subResources.type]; + break; + } + } + if (ret === undefined) { + throw new Error(`Failed to get expected data sources and type by ${outputName}`); + } + return ret; +}; + +/** + * Get ULP tolerance of conv2d/convTranspose2d operation. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getConv2dPrecisionTolerance = (resources, operationName) => { + // number of reduced input elements multiplied by filter and summed (a sliding dot product like pooling) + const inputNameArray = Object.keys(resources.inputs); + const inputShape = resources.inputs[inputNameArray[0]].shape; + const filterShape = resources.inputs[inputNameArray[1]].shape; + const options = resources.options; + let groups = 1; + let inputChannels = inputShape[1]; // default nchw inputLayout + // default oihw filterLayout for conv2d or default iohw filterLayout for convTranspose2d + let filterWidth = filterShape[3]; + let filterHeight = filterShape[2]; + if (options) { + if (options.groups) { + groups = options.groups; + } + if (options.inputLayout) { + if (!['nchw', 'nhwc'].includes(options.inputLayout)) { + throw new Error(`Unsupported inputLayout ${options.inputLayout}`); + } + inputChannels = options.inputLayout === 'nchw' ? inputChannels : inputShape[3]; + } + if (options.filterLayout) { + let filterLayouts = ['oihw', 'hwio', 'ohwi', 'ihwo']; // default for conv2d + if (operationName === 'convTranspose2d') { + filterLayouts = ['iohw', 'hwoi', 'ohwi']; + } + if (!filterLayouts.includes(options.filterLayout)) { + throw new Error(`Unsupported filterLayout ${options.filterLayout}`); + } + switch (options.filterLayout) { + case 'oihw': + case 'iohw': + // Just use the existing filterWidth and filterHeight above. + break; + case 'hwio': + case 'hwoi': + filterWidth = filterShape[1]; + filterHeight = filterShape[0]; + break; + case 'ohwi': + case 'ihwo': + filterWidth = filterShape[2]; + filterHeight = filterShape[1]; + break; + default: + break; + } + } + } + const tolerance = filterWidth * filterHeight * (inputChannels / groups) * 2; + return tolerance; +}; + +/** + * Get ULP tolerance of gemm operation. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getGemmPrecisionTolerance = (resources, operationName) => { + // GEMM : alpha * (A x B) + beta * C + // An upper bound for the worst serial ordering is bounded by + // the number of lossy operations, where matrix multiplication + // is a dot product (mul and add times the number of elements) + // plus bias operations. + const shapeA = resources.inputs[Object.keys(resources.inputs)[0]].shape; + const options = {...resources.options}; + const width = options.aTranspose ? shapeA[0] : shapeA[1]; + let tolerance = width * 2; + // default options.alpha is 1.0 + if (options.alpha !== undefined && options.alpha !== 1.0) { + tolerance++; + } + if (options.c && options.beta !== 0.0) { + // default options.beta is 1.0 + if (options.beta !== undefined && options.beta !== 1.0) { + tolerance++; + } + tolerance++; + } + return tolerance; +}; + +/** + * Get ULP tolerance of matmul operation. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getMatmulPrecisionTolerance = (resources, operationName) => { + // Matmul : Compute the matrix product of two input tensors. + // If a is 1-D, WebNN converts it to a 2-D tensor by prepending a 1 to its dimensions, [n] -> [1, n]. + // So we can just always check the last dimension here. + const shapeA = resources.inputs[Object.keys(resources.inputs)[0]].shape; + const tolerance = shapeA[shapeA.length - 1] * 2; + return tolerance; +}; + +/** + * Get ULP tolerance of averagePool2d operation. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getAveragePool2dPrecisionTolerance = (resources, operationName) => { + const inputShape = resources.inputs[Object.keys(resources.inputs)[0]].shape; + let height; + let width; + const options = {...resources.options}; + if (options.windowDimensions) { + height = options.windowDimensions[0]; + width = options.windowDimensions[1]; + } else { + // If not present, the window dimensions are assumed to be the height and width dimensions of the input shape + if (options.layout && options.layout === 'nhwc') { + height = inputShape[1]; + width = inputShape[2]; + } else { + // nhwc layout of input + height = inputShape[2]; + width = inputShape[3]; + } + } + + const tolerance = height * width + 2; + return tolerance; +}; + +/** + * Get ULP tolerance of softmax operation. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getSoftmaxPrecisionTolerance = (resources, operationName) => { + // Compute the softmax values of the 2-D input tensor along axis 1. + const inputShape = resources.inputs[Object.keys(resources.inputs)[0]].shape; + const tolerance = inputShape[1] * 3 + 3; + return tolerance; +}; + +/** + * Get ULP tolerance of reduction operations. + * @param {Object} resources - Resources used for building a graph + * @param {String} operationName - An operation name + * @returns {Number} A tolerance number + */ +const getReductionPrecisionTolerance = (resources, operationName) => { + const inputShape = resources.inputs[Object.keys(resources.inputs)[0]].shape; + const rank = inputShape.length; + const options = {...resources.options}; + let sizes; + if (options && options.axes) { + sizes = options.axes.map( + (axis) => axis < 0 ? inputShape[axis + rank] : inputShape[axis] + ); + } else { + sizes = inputShape; + } + const reducedElementCount = sizes.reduce( + (accumulator, currentValue) => accumulator * currentValue + ); + let tolerance; + switch (operationName) { + case 'reduceL1': + case 'reduceProduct': + case 'reduceSum': + tolerance = reducedElementCount; + break; + case 'reduceL2': + tolerance = reducedElementCount * 2 + 1; + break; + case 'reduceMean': + tolerance = reducedElementCount + 2; + break; + case 'reduceLogSum': + tolerance = reducedElementCount + 18; + break; + case 'reduceLogSumExp': + tolerance = reducedElementCount * 2 + 18; + break; + case 'reduceSumSquare': + tolerance = reducedElementCount * 2; + break; + default: + break; + } + return tolerance; +}; + +// Refer to precision metrics on https://github.com/webmachinelearning/webnn/issues/265#issuecomment-1256242643 +const PrecisionMetrics = { + batchNormalization: {ULP: {float32: 6, float16: 6}}, + clamp: {ULP: {float32: 0, float16: 0}}, + concat: {ULP: {float32: 0, float16: 0}}, + conv2d: {ULP: {float32: getConv2dPrecisionTolerance, float16: getConv2dPrecisionTolerance}}, + convTranspose2d: {ULP: {float32: getConv2dPrecisionTolerance, float16: getConv2dPrecisionTolerance}}, + // Begin Element-wise binary operations + add: {ULP: {float32: 1, float16: 1}}, + sub: {ULP: {float32: 1, float16: 1}}, + mul: {ULP: {float32: 1, float16: 1}}, + div: {ULP: {float32: 2, float16: 2}}, + max: {ULP: {float32: 0, float16: 0}}, + min: {ULP: {float32: 0, float16: 0}}, + pow: {ULP: {float32: 32, float16: 2}}, + // End Element-wise binary operations + // Begin Element-wise unary operations + abs: {ULP: {float32: 0, float16: 0}}, + ceil: {ULP: {float32: 0, float16: 0}}, + cos: {ATOL: {float32: 1/1024, float16: 1/512}}, + exp: {ULP: {float32: 32, float16: 1}}, + floor: {ULP: {float32: 0, float16: 0}}, + log: {ATOL: {float32: 1/1024, float16: 1/1024}}, + neg: {ULP: {float32: 0, float16: 0}}, + sin: {ATOL: {float32: 1/1024, float16: 1/512}}, + tan: {ATOL: {float32: 1/1024, float16: 1/512}}, + // End Element-wise unary operations + elu: {ULP: {float32: 18, float16: 18}}, + gemm: {ULP: {float32: getGemmPrecisionTolerance, float16: getGemmPrecisionTolerance}}, + hardSigmoid: {ULP: {float32: 2, float16: 2}}, + hardSwish: {ULP: {float32: 4, float16: 4}}, + leakyRelu: {ULP: {float32: 1, float16: 1}}, + linear: {ULP: {float32: 2, float16: 2}}, + matmul: {ULP: {float32: getMatmulPrecisionTolerance, float16: getMatmulPrecisionTolerance}}, + pad: {ULP: {float32: 0, float16: 0}}, + // Begin Pooling operations + averagePool2d: {ULP: {float32: getAveragePool2dPrecisionTolerance, float16: getAveragePool2dPrecisionTolerance}}, + maxPool2d: {ULP: {float32: 0, float16: 0}}, + // End Pooling operations + prelu: {ULP: {float32: 1, float16: 1}}, + // Begin Reduction operations + reduceL1: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceL2: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceLogSum: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceLogSumExp: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceMax: {ULP: {float32: 0, float16: 0}}, + reduceMean: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceMin: {ULP: {float32: 0, float16: 0}}, + reduceProduct: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceSum: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + reduceSumSquare: {ULP: {float32: getReductionPrecisionTolerance, float16: getReductionPrecisionTolerance}}, + // End Reduction operations + relu: {ULP: {float32: 0, float16: 0}}, + reshape: {ULP: {float32: 0, float16: 0}}, + sigmoid: {ULP: {float32: 32+2, float16: 3}}, // float32 (leaving a few ULP for roundoff) + slice: {ULP: {float32: 0, float16: 0}}, + softmax: {ULP: {float32: getSoftmaxPrecisionTolerance, float16: getSoftmaxPrecisionTolerance}}, + softsign: {ULP: {float32: 3, float16: 3}}, + split: {ULP: {float32: 0, float16: 0}}, + squeeze: {ULP: {float32: 0, float16: 0}}, + tanh: {ATOL: {float32: 1/1024, float16: 1/512}}, + transpose: {ULP: {float32: 0, float16: 0}}, +}; + +/** + * Get precison tolerance value. + * @param {String} operationName - An operation name + * @param {String} metricType - Value: 'ULP', 'ATOL' + * @param {Object} resources - Resources used for building a graph + * @returns {Number} A tolerance number + */ +const getPrecisonTolerance = (operationName, metricType, resources) => { + // the outputs by split or gru is a sequence + const precisionType = Array.isArray(resources.expected) ? resources.expected[0].type : resources.expected.type; + let tolerance = PrecisionMetrics[operationName][metricType][precisionType]; + // If the tolerance is dynamic, then evaluate the function to get the value. + if (tolerance instanceof Function) { + tolerance = tolerance(resources, operationName); + } + return tolerance; +}; + +/** + * Get bitwise of the given value. + * @param {Number} value + * @param {String} dataType - A data type string, like "float32", "float16", + * more types, please see: + * https://webmachinelearning.github.io/webnn/#enumdef-mloperandtype + * @return {Number} A 64-bit signed integer. + */ +const getBitwise = (value, dataType) => { + const buffer = new ArrayBuffer(8); + const int64Array = new BigInt64Array(buffer); + int64Array[0] = value < 0 ? ~BigInt(0) : BigInt(0); + let typedArray; + if (dataType === "float32") { + typedArray = new Float32Array(buffer); + } else { + throw new AssertionError(`Data type ${dataType} is not supported`); + } + typedArray[0] = value; + return int64Array[0]; +}; + +/** + * Assert that each array property in ``actual`` is a number being close enough to the corresponding + * property in ``expected`` by the acceptable ULP distance ``nulp`` with given ``dataType`` data type. + * + * @param {Array} actual - Array of test values. + * @param {Array} expected - Array of values expected to be close to the values in ``actual``. + * @param {Number} nulp - A BigInt value indicates acceptable ULP distance. + * @param {String} dataType - A data type string, value: "float32", + * more types, please see: + * https://webmachinelearning.github.io/webnn/#enumdef-mloperandtype + * @param {String} description - Description of the condition being tested. + */ +const assert_array_approx_equals_ulp = (actual, expected, nulp, dataType, description) => { + /* + * Test if two primitive arrays are equal within acceptable ULP distance + */ + assert_true(actual.length === expected.length, + `assert_array_approx_equals_ulp: ${description} lengths differ, expected ${expected.length} but got ${actual.length}`); + let actualBitwise, expectedBitwise, distance; + for (let i = 0; i < actual.length; i++) { + if (actual[i] === expected[i]) { + continue; + } else { + // measure the ULP distance + actualBitwise = getBitwise(actual[i], dataType); + expectedBitwise = getBitwise(expected[i], dataType); + distance = actualBitwise - expectedBitwise; + distance = distance >= 0 ? distance : -distance; + assert_true(distance <= nulp, + `assert_array_approx_equals_ulp: ${description} actual ${actual[i]} should be close enough to expected ${expected[i]} by the acceptable ${nulp} ULP distance, but they have ${distance} ULP distance`); + } + } +}; + +/** + * Assert actual results with expected results. + * @param {String} operationName - An operation name + * @param {(Number[]|Number)} actual + * @param {(Number[]|Number)} expected + * @param {Number} tolerance + * @param {String} operandType - An operand type string, value: "float32", + * more types, please see: + * https://webmachinelearning.github.io/webnn/#enumdef-mloperandtype + * @param {String} metricType - Value: 'ULP', 'ATOL' + */ +const doAssert = (operationName, actual, expected, tolerance, operandType, metricType) => { + const description = `test ${operationName} ${operandType}`; + if (typeof expected === 'number') { + // for checking a scalar output by matmul 1D x 1D + expected = [expected]; + actual = [actual]; + } + if (metricType === 'ULP') { + assert_array_approx_equals_ulp(actual, expected, tolerance, operandType, description); + } else if (metricType === 'ATOL') { + assert_array_approx_equals(actual, expected, tolerance, description); + } +}; + +/** + * Check computed results with expected data. + * @param {String} operationName - An operation name + * @param {Object.<String, MLOperand>} namedOutputOperands + * @param {Object.<MLNamedArrayBufferViews>} outputs - The resources of required outputs + * @param {Object} resources - Resources used for building a graph + */ +const checkResults = (operationName, namedOutputOperands, outputs, resources) => { + const metricType = Object.keys(PrecisionMetrics[operationName])[0]; + const expected = resources.expected; + let tolerance; + let operandType; + let outputData; + let expectedData; + if (Array.isArray(expected)) { + // the outputs of split() or gru() is a sequence + for (let operandName in namedOutputOperands) { + outputData = outputs[operandName]; + // for some operations which may have multi outputs of different types + [expectedData, operandType] = getExpectedDataAndType(expected, operandName); + tolerance = getPrecisonTolerance(operationName, metricType, resources); + doAssert(operationName, outputData, expectedData, tolerance, operandType, metricType) + } + } else { + outputData = outputs[expected.name]; + expectedData = expected.data; + operandType = expected.type; + tolerance = getPrecisonTolerance(operationName, metricType, resources); + doAssert(operationName, outputData, expectedData, tolerance, operandType, metricType) + } +}; + +/** + * Create a constant operand + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for constant operand + * @returns {MLOperand} A constant operand + */ +const createConstantOperand = (builder, resources) => { + const bufferView = new TypedArrayDict[resources.type](resources.data); + return builder.constant({type: resources.type, dimensions: resources.shape}, bufferView); +}; + +/** + * Create single input operands for a graph. + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @param {String} [inputOperandName] - An inputOperand name + * @returns {MLOperand} An input operand + */ +const createSingleInputOperand = (builder, resources, inputOperandName) => { + inputOperandName = inputOperandName ? inputOperandName : Object.keys(resources.inputs)[0]; + const inputResources = resources.inputs[inputOperandName]; + return builder.input(inputOperandName, {type: inputResources.type, dimensions: inputResources.shape}); +}; + +/** + * Create multi input operands for a graph. + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @returns {MLOperand[]} Input operands array + */ +const createMultiInputOperands = (builder, resources) => { + let inputOperands = []; + const inputOperandNameArray = Object.keys(resources.inputs); + inputOperandNameArray.forEach(inputOperandName => { + let operand; + if (resources.inputs[inputOperandName].hasOwnProperty('constant') && resources.inputs[inputOperandName]['constant']) { + operand = createConstantOperand(builder, resources.inputs[inputOperandName]); + } else { + operand = createSingleInputOperand(builder, resources, inputOperandName); + } + inputOperands.push(operand); + }); + return inputOperands; +}; + +/** + * Build an operation which has a single input. + * @param {String} operationName - An operation name + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @returns {MLNamedOperands} + */ +const buildOperationWithSingleInput = (operationName, builder, resources) => { + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + const outputOperand = resources.options ? + builder[operationName](inputOperand, resources.options) : builder[operationName](inputOperand); + namedOutputOperand[resources.expected.name] = outputOperand; + return namedOutputOperand; +}; + +/** + * Build an operation which has two inputs. + * @param {String} operationName - An operation name + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @returns {MLNamedOperands} + */ +const buildOperationWithTwoInputs= (operationName, builder, resources) => { + // For example: MLOperand matmul(MLOperand a, MLOperand b); + const namedOutputOperand = {}; + const [inputOperandA, inputOperandB] = createMultiInputOperands(builder, resources); + const outputOperand = resources.options ? + builder[operationName](inputOperandA, inputOperandB, resources.options) : builder[operationName](inputOperandA, inputOperandB); + namedOutputOperand[resources.expected.name] = outputOperand; + return namedOutputOperand; +}; + +/** + * Build a graph. + * @param {String} operationName - An operation name + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @param {Function} buildFunc - A build function for an operation + * @returns [namedOperands, inputs, outputs] + */ +const buildGraph = (operationName, builder, resources, buildFunc) => { + const namedOperands = buildFunc(operationName, builder, resources); + let inputs = {}; + if (Array.isArray(resources.inputs)) { + // the inputs of concat() is a sequence + for (let subInput of resources.inputs) { + if (!subInput.hasOwnProperty('constant') || !subInput.constant) { + inputs[subInput.name] = new TypedArrayDict[subInput.type](subInput.data); + } + } + } else { + for (let inputName in resources.inputs) { + const subTestByName = resources.inputs[inputName]; + if (!subTestByName.hasOwnProperty('constant') || !subTestByName.constant) { + inputs[inputName] = new TypedArrayDict[subTestByName.type](subTestByName.data); + } + } + } + let outputs = {}; + if (Array.isArray(resources.expected)) { + // the outputs of split() or gru() is a sequence + for (let i = 0; i < resources.expected.length; i++) { + const subExpected = resources.expected[i]; + outputs[subExpected.name] = new TypedArrayDict[subExpected.type](sizeOfShape(subExpected.shape)); + } + } else { + // matmul 1D with 1D produces a scalar which doesn't have its shape + const shape = resources.expected.shape ? resources.expected.shape : [1]; + outputs[resources.expected.name] = new TypedArrayDict[resources.expected.type](sizeOfShape(shape)); + } + return [namedOperands, inputs, outputs]; +}; + +/** + * Build a graph, synchronously compile graph and execute, then check computed results. + * @param {String} operationName - An operation name + * @param {MLContext} context - A ML context + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @param {Function} buildFunc - A build function for an operation + */ +const runSync = (operationName, context, builder, resources, buildFunc) => { + // build a graph + const [namedOutputOperands, inputs, outputs] = buildGraph(operationName, builder, resources, buildFunc); + // synchronously compile the graph up to the output operand + const graph = builder.buildSync(namedOutputOperands); + // synchronously execute the compiled graph. + context.computeSync(graph, inputs, outputs); + checkResults(operationName, namedOutputOperands, outputs, resources); +}; + +/** + * Build a graph, asynchronously compile graph and execute, then check computed results. + * @param {String} operationName - An operation name + * @param {MLContext} context - A ML context + * @param {MLGraphBuilder} builder - A ML graph builder + * @param {Object} resources - Resources used for building a graph + * @param {Function} buildFunc - A build function for an operation + */ +const run = async (operationName, context, builder, resources, buildFunc) => { + // build a graph + const [namedOutputOperands, inputs, outputs] = buildGraph(operationName, builder, resources, buildFunc); + // asynchronously compile the graph up to the output operand + const graph = await builder.build(namedOutputOperands); + // asynchronously execute the compiled graph + const result = await context.compute(graph, inputs, outputs); + checkResults(operationName, namedOutputOperands, result.outputs, resources); +}; + +/** + * Run WebNN operation tests. + * @param {(String[]|String)} operationName - An operation name array or an operation name + * @param {Function} buildFunc - A build function for an operation + */ +const testWebNNOperation = (operationName, buildFunc) => { + let operationNameArray; + if (typeof operationName === 'string') { + operationNameArray = [operationName]; + } else if (Array.isArray(operationName)) { + operationNameArray = operationName; + } + + ExecutionArray.forEach(executionType => { + const isSync = executionType === 'sync'; + if (self.GLOBAL.isWindow() && isSync) { + return; + } + let context; + let builder; + if (isSync) { + // test sync + operationNameArray.forEach((subOperationName) => { + const tests = loadTests(subOperationName); + setup(() => { + context = navigator.ml.createContextSync(); + builder = new MLGraphBuilder(context); + }); + for (const subTest of tests) { + test(() => { + runSync(subOperationName, context, builder, subTest, buildFunc); + }, `${subTest.name} / ${executionType}`); + } + }); + } else { + // test async + operationNameArray.forEach((subOperationName) => { + const tests = loadTests(subOperationName); + promise_setup(async () => { + context = await navigator.ml.createContext(); + builder = new MLGraphBuilder(context); + }); + for (const subTest of tests) { + promise_test(async () => { + await run(subOperationName, context, builder, subTest, buildFunc); + }, `${subTest.name} / ${executionType}`); + } + }); + } + }); +};
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/sigmoid.https.any.js b/testing/web-platform/tests/webnn/sigmoid.https.any.js new file mode 100644 index 0000000000..e904d8dfa7 --- /dev/null +++ b/testing/web-platform/tests/webnn/sigmoid.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API sigmoid operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-sigmoid + +testWebNNOperation('sigmoid', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/slice.https.any.js b/testing/web-platform/tests/webnn/slice.https.any.js new file mode 100644 index 0000000000..5e188af535 --- /dev/null +++ b/testing/web-platform/tests/webnn/slice.https.any.js @@ -0,0 +1,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<unsigned long> starts, sequence<unsigned long> sizes); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.slice() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.starts, resources.sizes); + return namedOutputOperand; +}; + +testWebNNOperation('slice', buildSlice);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/softmax.https.any.js b/testing/web-platform/tests/webnn/softmax.https.any.js new file mode 100644 index 0000000000..8e5342bd75 --- /dev/null +++ b/testing/web-platform/tests/webnn/softmax.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API softmax operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softmax + +testWebNNOperation('softmax', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/softsign.https.any.js b/testing/web-platform/tests/webnn/softsign.https.any.js new file mode 100644 index 0000000000..61a7d5365f --- /dev/null +++ b/testing/web-platform/tests/webnn/softsign.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API softsign operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softsign + +testWebNNOperation('softsign', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/split.https.any.js b/testing/web-platform/tests/webnn/split.https.any.js new file mode 100644 index 0000000000..bb1c995658 --- /dev/null +++ b/testing/web-platform/tests/webnn/split.https.any.js @@ -0,0 +1,24 @@ +// META: title=test WebNN API split operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-split + +const buildSplit = (operationName, builder, resources) => { + // sequence<MLOperand> split(MLOperand input, + // (unsigned long or sequence<unsigned long>) splits, + // optional MLSplitOptions options = {}); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.split() + const outputOperands = builder[operationName](inputOperand, resources.splits, resources.options); + resources.expected.forEach((resourceDict, index) => { + namedOutputOperand[resourceDict.name] = outputOperands[index]; + }); + return namedOutputOperand; +}; + +testWebNNOperation('split', buildSplit);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/squeeze.https.any.js b/testing/web-platform/tests/webnn/squeeze.https.any.js new file mode 100644 index 0000000000..8b9310d65d --- /dev/null +++ b/testing/web-platform/tests/webnn/squeeze.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API squeeze operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-squeeze + +testWebNNOperation('squeeze', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/tanh.https.any.js b/testing/web-platform/tests/webnn/tanh.https.any.js new file mode 100644 index 0000000000..d0d45e754b --- /dev/null +++ b/testing/web-platform/tests/webnn/tanh.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API tanh operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-tanh + +testWebNNOperation('tanh', buildOperationWithSingleInput);
\ No newline at end of file diff --git a/testing/web-platform/tests/webnn/transpose.https.any.js b/testing/web-platform/tests/webnn/transpose.https.any.js new file mode 100644 index 0000000000..63a123342a --- /dev/null +++ b/testing/web-platform/tests/webnn/transpose.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API transpose operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-transpose + +testWebNNOperation('transpose', buildOperationWithSingleInput);
\ No newline at end of file |