From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/webnn/META.yml | 4 + .../tests/webnn/arg_min_max.https.any.js | 10 + .../tests/webnn/batch_normalization.https.any.js | 10 + testing/web-platform/tests/webnn/cast.https.any.js | 10 + .../web-platform/tests/webnn/clamp.https.any.js | 10 + .../web-platform/tests/webnn/concat.https.any.js | 10 + .../web-platform/tests/webnn/conv2d.https.any.js | 10 + .../tests/webnn/conv_transpose2d.https.any.js | 10 + .../tests/webnn/elementwise_binary.https.any.js | 10 + .../tests/webnn/elementwise_logical.https.any.js | 20 + .../tests/webnn/elementwise_unary.https.any.js | 13 + testing/web-platform/tests/webnn/elu.https.any.js | 10 + .../web-platform/tests/webnn/expand.https.any.js | 11 + .../web-platform/tests/webnn/gather.https.any.js | 10 + testing/web-platform/tests/webnn/gemm.https.any.js | 10 + .../tests/webnn/gpu/arg_min_max.https.any.js | 10 + .../webnn/gpu/batch_normalization.https.any.js | 10 + .../web-platform/tests/webnn/gpu/cast.https.any.js | 10 + .../tests/webnn/gpu/clamp.https.any.js | 10 + .../tests/webnn/gpu/concat.https.any.js | 10 + .../tests/webnn/gpu/conv2d.https.any.js | 10 + .../tests/webnn/gpu/conv_transpose2d.https.any.js | 10 + .../webnn/gpu/elementwise_binary.https.any.js | 10 + .../webnn/gpu/elementwise_logical.https.any.js | 20 + .../tests/webnn/gpu/elementwise_unary.https.any.js | 13 + .../web-platform/tests/webnn/gpu/elu.https.any.js | 10 + .../tests/webnn/gpu/expand.https.any.js | 11 + .../tests/webnn/gpu/gather.https.any.js | 10 + .../web-platform/tests/webnn/gpu/gemm.https.any.js | 10 + .../tests/webnn/gpu/hard_sigmoid.https.any.js | 10 + .../tests/webnn/gpu/hard_swish.https.any.js | 10 + .../webnn/gpu/instance_normalization.https.any.js | 10 + .../webnn/gpu/layer_normalization.https.any.js | 10 + .../tests/webnn/gpu/leaky_relu.https.any.js | 10 + .../tests/webnn/gpu/linear.https.any.js | 10 + .../tests/webnn/gpu/matmul.https.any.js | 10 + .../web-platform/tests/webnn/gpu/pad.https.any.js | 10 + .../tests/webnn/gpu/pooling.https.any.js | 10 + .../tests/webnn/gpu/prelu.https.any.js | 10 + .../tests/webnn/gpu/reduction.https.any.js | 24 + .../web-platform/tests/webnn/gpu/relu.https.any.js | 10 + .../tests/webnn/gpu/reshape.https.any.js | 11 + .../tests/webnn/gpu/sigmoid.https.any.js | 10 + .../tests/webnn/gpu/slice.https.any.js | 10 + .../tests/webnn/gpu/softmax.https.any.js | 10 + .../tests/webnn/gpu/softplus.https.any.js | 10 + .../tests/webnn/gpu/softsign.https.any.js | 10 + .../tests/webnn/gpu/split.https.any.js | 10 + .../web-platform/tests/webnn/gpu/tanh.https.any.js | 10 + .../tests/webnn/gpu/transpose.https.any.js | 10 + .../tests/webnn/gpu/where.https.any.js | 10 + .../tests/webnn/hard_sigmoid.https.any.js | 10 + .../tests/webnn/hard_swish.https.any.js | 10 + .../tests/webnn/idlharness.https.any.js | 56 + .../webnn/instance_normalization.https.any.js | 10 + .../tests/webnn/layer_normalization.https.any.js | 10 + .../tests/webnn/leaky_relu.https.any.js | 10 + .../web-platform/tests/webnn/linear.https.any.js | 10 + .../web-platform/tests/webnn/matmul.https.any.js | 10 + testing/web-platform/tests/webnn/pad.https.any.js | 10 + .../web-platform/tests/webnn/pooling.https.any.js | 10 + .../web-platform/tests/webnn/prelu.https.any.js | 10 + .../tests/webnn/reduction.https.any.js | 24 + testing/web-platform/tests/webnn/relu.https.any.js | 10 + .../web-platform/tests/webnn/reshape.https.any.js | 11 + .../tests/webnn/resources/test_data/abs.json | 401 +++ .../tests/webnn/resources/test_data/add.json | 882 +++++ .../tests/webnn/resources/test_data/arg_max.json | 963 +++++ .../tests/webnn/resources/test_data/arg_min.json | 963 +++++ .../webnn/resources/test_data/average_pool2d.json | 1684 +++++++++ .../resources/test_data/batch_normalization.json | 1181 +++++++ .../tests/webnn/resources/test_data/cast.json | 3040 ++++++++++++++++ .../tests/webnn/resources/test_data/ceil.json | 401 +++ .../tests/webnn/resources/test_data/clamp.json | 1169 +++++++ .../tests/webnn/resources/test_data/concat.json | 3666 ++++++++++++++++++++ .../tests/webnn/resources/test_data/conv2d.json | 2213 ++++++++++++ .../resources/test_data/conv_transpose2d.json | 2581 ++++++++++++++ .../tests/webnn/resources/test_data/cos.json | 401 +++ .../tests/webnn/resources/test_data/div.json | 882 +++++ .../tests/webnn/resources/test_data/elu.json | 539 +++ .../tests/webnn/resources/test_data/equal.json | 982 ++++++ .../tests/webnn/resources/test_data/erf.json | 421 +++ .../tests/webnn/resources/test_data/exp.json | 401 +++ .../tests/webnn/resources/test_data/expand.json | 994 ++++++ .../tests/webnn/resources/test_data/floor.json | 401 +++ .../tests/webnn/resources/test_data/gather.json | 1268 +++++++ .../tests/webnn/resources/test_data/gemm.json | 1953 +++++++++++ .../tests/webnn/resources/test_data/greater.json | 982 ++++++ .../resources/test_data/greater_or_equal.json | 970 ++++++ .../webnn/resources/test_data/hard_sigmoid.json | 957 +++++ .../webnn/resources/test_data/hard_swish.json | 401 +++ .../tests/webnn/resources/test_data/identity.json | 422 +++ .../test_data/instance_normalization.json | 519 +++ .../resources/test_data/layer_normalization.json | 842 +++++ .../webnn/resources/test_data/leaky_relu.json | 609 ++++ .../tests/webnn/resources/test_data/lesser.json | 970 ++++++ .../webnn/resources/test_data/lesser_or_equal.json | 970 ++++++ .../tests/webnn/resources/test_data/linear.json | 818 +++++ .../tests/webnn/resources/test_data/log.json | 401 +++ .../webnn/resources/test_data/logical_not.json | 421 +++ .../tests/webnn/resources/test_data/matmul.json | 1439 ++++++++ .../tests/webnn/resources/test_data/max.json | 882 +++++ .../webnn/resources/test_data/max_pool2d.json | 1439 ++++++++ .../tests/webnn/resources/test_data/min.json | 882 +++++ .../tests/webnn/resources/test_data/mul.json | 882 +++++ .../tests/webnn/resources/test_data/neg.json | 401 +++ .../tests/webnn/resources/test_data/pad.json | 797 +++++ .../tests/webnn/resources/test_data/pow.json | 880 +++++ .../tests/webnn/resources/test_data/prelu.json | 966 ++++++ .../webnn/resources/test_data/reciprocal.json | 421 +++ .../tests/webnn/resources/test_data/reduce_l1.json | 743 ++++ .../tests/webnn/resources/test_data/reduce_l2.json | 743 ++++ .../webnn/resources/test_data/reduce_log_sum.json | 663 ++++ .../resources/test_data/reduce_log_sum_exp.json | 743 ++++ .../webnn/resources/test_data/reduce_max.json | 623 ++++ .../webnn/resources/test_data/reduce_mean.json | 735 ++++ .../webnn/resources/test_data/reduce_min.json | 623 ++++ .../webnn/resources/test_data/reduce_product.json | 623 ++++ .../webnn/resources/test_data/reduce_sum.json | 735 ++++ .../resources/test_data/reduce_sum_square.json | 743 ++++ .../tests/webnn/resources/test_data/relu.json | 401 +++ .../tests/webnn/resources/test_data/reshape.json | 2056 +++++++++++ .../tests/webnn/resources/test_data/sigmoid.json | 401 +++ .../tests/webnn/resources/test_data/sin.json | 401 +++ .../tests/webnn/resources/test_data/slice.json | 311 ++ .../tests/webnn/resources/test_data/softmax.json | 203 ++ .../tests/webnn/resources/test_data/softplus.json | 539 +++ .../tests/webnn/resources/test_data/softsign.json | 467 +++ .../tests/webnn/resources/test_data/split.json | 744 ++++ .../tests/webnn/resources/test_data/sqrt.json | 421 +++ .../tests/webnn/resources/test_data/sub.json | 882 +++++ .../tests/webnn/resources/test_data/tan.json | 401 +++ .../tests/webnn/resources/test_data/tanh.json | 401 +++ .../tests/webnn/resources/test_data/transpose.json | 746 ++++ .../tests/webnn/resources/test_data/where.json | 1817 ++++++++++ .../web-platform/tests/webnn/resources/utils.js | 929 +++++ .../web-platform/tests/webnn/sigmoid.https.any.js | 10 + .../web-platform/tests/webnn/slice.https.any.js | 10 + .../web-platform/tests/webnn/softmax.https.any.js | 10 + .../web-platform/tests/webnn/softplus.https.any.js | 10 + .../web-platform/tests/webnn/softsign.https.any.js | 10 + .../web-platform/tests/webnn/split.https.any.js | 10 + testing/web-platform/tests/webnn/tanh.https.any.js | 10 + .../tests/webnn/transpose.https.any.js | 10 + .../web-platform/tests/webnn/where.https.any.js | 10 + 145 files changed, 64589 insertions(+) create mode 100644 testing/web-platform/tests/webnn/META.yml create mode 100644 testing/web-platform/tests/webnn/arg_min_max.https.any.js create mode 100644 testing/web-platform/tests/webnn/batch_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/cast.https.any.js create mode 100644 testing/web-platform/tests/webnn/clamp.https.any.js create mode 100644 testing/web-platform/tests/webnn/concat.https.any.js create mode 100644 testing/web-platform/tests/webnn/conv2d.https.any.js create mode 100644 testing/web-platform/tests/webnn/conv_transpose2d.https.any.js create mode 100644 testing/web-platform/tests/webnn/elementwise_binary.https.any.js create mode 100644 testing/web-platform/tests/webnn/elementwise_logical.https.any.js create mode 100644 testing/web-platform/tests/webnn/elementwise_unary.https.any.js create mode 100644 testing/web-platform/tests/webnn/elu.https.any.js create mode 100644 testing/web-platform/tests/webnn/expand.https.any.js create mode 100644 testing/web-platform/tests/webnn/gather.https.any.js create mode 100644 testing/web-platform/tests/webnn/gemm.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/arg_min_max.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/batch_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/cast.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/clamp.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/concat.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/conv2d.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/conv_transpose2d.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/elementwise_binary.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/elementwise_logical.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/elementwise_unary.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/elu.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/expand.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/gather.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/gemm.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/hard_sigmoid.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/hard_swish.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/instance_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/layer_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/leaky_relu.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/linear.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/matmul.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/pad.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/pooling.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/prelu.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/reduction.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/relu.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/reshape.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/sigmoid.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/slice.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/softmax.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/softplus.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/softsign.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/split.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/tanh.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/transpose.https.any.js create mode 100644 testing/web-platform/tests/webnn/gpu/where.https.any.js create mode 100644 testing/web-platform/tests/webnn/hard_sigmoid.https.any.js create mode 100644 testing/web-platform/tests/webnn/hard_swish.https.any.js create mode 100644 testing/web-platform/tests/webnn/idlharness.https.any.js create mode 100644 testing/web-platform/tests/webnn/instance_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/layer_normalization.https.any.js create mode 100644 testing/web-platform/tests/webnn/leaky_relu.https.any.js create mode 100644 testing/web-platform/tests/webnn/linear.https.any.js create mode 100644 testing/web-platform/tests/webnn/matmul.https.any.js create mode 100644 testing/web-platform/tests/webnn/pad.https.any.js create mode 100644 testing/web-platform/tests/webnn/pooling.https.any.js create mode 100644 testing/web-platform/tests/webnn/prelu.https.any.js create mode 100644 testing/web-platform/tests/webnn/reduction.https.any.js create mode 100644 testing/web-platform/tests/webnn/relu.https.any.js create mode 100644 testing/web-platform/tests/webnn/reshape.https.any.js create mode 100644 testing/web-platform/tests/webnn/resources/test_data/abs.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/add.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/arg_max.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/arg_min.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/average_pool2d.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/batch_normalization.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/cast.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/ceil.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/clamp.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/concat.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/conv2d.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/conv_transpose2d.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/cos.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/div.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/elu.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/equal.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/erf.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/exp.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/expand.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/floor.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/gather.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/gemm.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/greater.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/greater_or_equal.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/hard_sigmoid.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/hard_swish.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/identity.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/instance_normalization.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/layer_normalization.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/leaky_relu.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/lesser.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/lesser_or_equal.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/linear.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/log.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/logical_not.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/matmul.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/max.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/max_pool2d.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/min.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/mul.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/neg.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/pad.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/pow.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/prelu.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reciprocal.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_l1.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_l2.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum_exp.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_max.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_mean.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_min.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_product.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_sum.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reduce_sum_square.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/relu.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/reshape.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/sigmoid.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/sin.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/slice.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/softmax.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/softplus.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/softsign.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/split.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/sqrt.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/sub.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/tan.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/tanh.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/transpose.json create mode 100644 testing/web-platform/tests/webnn/resources/test_data/where.json create mode 100644 testing/web-platform/tests/webnn/resources/utils.js create mode 100644 testing/web-platform/tests/webnn/sigmoid.https.any.js create mode 100644 testing/web-platform/tests/webnn/slice.https.any.js create mode 100644 testing/web-platform/tests/webnn/softmax.https.any.js create mode 100644 testing/web-platform/tests/webnn/softplus.https.any.js create mode 100644 testing/web-platform/tests/webnn/softsign.https.any.js create mode 100644 testing/web-platform/tests/webnn/split.https.any.js create mode 100644 testing/web-platform/tests/webnn/tanh.https.any.js create mode 100644 testing/web-platform/tests/webnn/transpose.https.any.js create mode 100644 testing/web-platform/tests/webnn/where.https.any.js (limited to 'testing/web-platform/tests/webnn') 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/arg_min_max.https.any.js b/testing/web-platform/tests/webnn/arg_min_max.https.any.js new file mode 100644 index 0000000000..cff1d6a955 --- /dev/null +++ b/testing/web-platform/tests/webnn/arg_min_max.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API argMin/Max operations +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax + +testWebNNOperation(['argMin', 'argMax'], buildOperationWithSingleInput); \ 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..15e66a8bc0 --- /dev/null +++ b/testing/web-platform/tests/webnn/batch_normalization.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('batchNormalization', buildBatchNorm); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/cast.https.any.js b/testing/web-platform/tests/webnn/cast.https.any.js new file mode 100644 index 0000000000..c9be45a770 --- /dev/null +++ b/testing/web-platform/tests/webnn/cast.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API cast operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast + +testWebNNOperation('cast', buildCast); \ 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..cce43e492f --- /dev/null +++ b/testing/web-platform/tests/webnn/concat.https.any.js @@ -0,0 +1,10 @@ +// 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 + +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..b26b35ec67 --- /dev/null +++ b/testing/web-platform/tests/webnn/conv2d.https.any.js @@ -0,0 +1,10 @@ +// 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 + +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..99e76b825e --- /dev/null +++ b/testing/web-platform/tests/webnn/conv_transpose2d.https.any.js @@ -0,0 +1,10 @@ +// 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 + +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_logical.https.any.js b/testing/web-platform/tests/webnn/elementwise_logical.https.any.js new file mode 100644 index 0000000000..e614b94df5 --- /dev/null +++ b/testing/web-platform/tests/webnn/elementwise_logical.https.any.js @@ -0,0 +1,20 @@ +// META: title=test WebNN API element-wise logical operations +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-logical + +testWebNNOperation( + [ + 'equal', + 'greater', + 'greaterOrEqual', + 'lesser', + 'lesserOrEqual', + ], + buildOperationWithTwoInputs +); +testWebNNOperation('logicalNot', buildOperationWithSingleInput); \ 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..4cdfee5bcb --- /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', 'erf', 'exp', 'floor', 'identity', 'log', 'neg', 'reciprocal', 'sin', 'sqrt', '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/expand.https.any.js b/testing/web-platform/tests/webnn/expand.https.any.js new file mode 100644 index 0000000000..11abb9baa8 --- /dev/null +++ b/testing/web-platform/tests/webnn/expand.https.any.js @@ -0,0 +1,11 @@ +// META: title=test WebNN API expand operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand + +// reuse buildReshape method +testWebNNOperation('expand', buildReshape); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gather.https.any.js b/testing/web-platform/tests/webnn/gather.https.any.js new file mode 100644 index 0000000000..52bcece804 --- /dev/null +++ b/testing/web-platform/tests/webnn/gather.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API gather operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather + +testWebNNOperation('gather', buildOperationWithTwoInputs); \ 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..e5de9521fb --- /dev/null +++ b/testing/web-platform/tests/webnn/gemm.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('gemm', buildGemm); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/arg_min_max.https.any.js b/testing/web-platform/tests/webnn/gpu/arg_min_max.https.any.js new file mode 100644 index 0000000000..76092ea92e --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/arg_min_max.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API argMin/Max operations +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax + +testWebNNOperation(['argMin', 'argMax'], buildOperationWithSingleInput, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/batch_normalization.https.any.js b/testing/web-platform/tests/webnn/gpu/batch_normalization.https.any.js new file mode 100644 index 0000000000..90b6def636 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/batch_normalization.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('batchNormalization', buildBatchNorm, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/cast.https.any.js b/testing/web-platform/tests/webnn/gpu/cast.https.any.js new file mode 100644 index 0000000000..1830364eb5 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/cast.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API cast operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast + +testWebNNOperation('cast', buildCast, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/clamp.https.any.js b/testing/web-platform/tests/webnn/gpu/clamp.https.any.js new file mode 100644 index 0000000000..98313868b6 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/concat.https.any.js b/testing/web-platform/tests/webnn/gpu/concat.https.any.js new file mode 100644 index 0000000000..07073724fe --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/concat.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('concat', buildConcat, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/conv2d.https.any.js b/testing/web-platform/tests/webnn/gpu/conv2d.https.any.js new file mode 100644 index 0000000000..b3986b6555 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/conv2d.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('conv2d', buildConv2d, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/conv_transpose2d.https.any.js b/testing/web-platform/tests/webnn/gpu/conv_transpose2d.https.any.js new file mode 100644 index 0000000000..020bfa9c97 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/conv_transpose2d.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('convTranspose2d', buildConvTranspose2d, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/elementwise_binary.https.any.js b/testing/web-platform/tests/webnn/gpu/elementwise_binary.https.any.js new file mode 100644 index 0000000000..035d0c77c0 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/elementwise_logical.https.any.js b/testing/web-platform/tests/webnn/gpu/elementwise_logical.https.any.js new file mode 100644 index 0000000000..f597ce8e0b --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/elementwise_logical.https.any.js @@ -0,0 +1,20 @@ +// META: title=test WebNN API element-wise logical operations +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-logical + +testWebNNOperation( + [ + 'equal', + 'greater', + 'greaterOrEqual', + 'lesser', + 'lesserOrEqual', + ], + buildOperationWithTwoInputs, 'gpu' +); +testWebNNOperation('logicalNot', buildOperationWithSingleInput, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/elementwise_unary.https.any.js b/testing/web-platform/tests/webnn/gpu/elementwise_unary.https.any.js new file mode 100644 index 0000000000..45978f91ec --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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', 'erf', 'exp', 'floor', 'identity', 'log', 'neg', 'reciprocal', 'sin', 'sqrt', 'tan'], + buildOperationWithSingleInput, 'gpu' +); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/elu.https.any.js b/testing/web-platform/tests/webnn/gpu/elu.https.any.js new file mode 100644 index 0000000000..965bb4d35f --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/expand.https.any.js b/testing/web-platform/tests/webnn/gpu/expand.https.any.js new file mode 100644 index 0000000000..82fa891a39 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/expand.https.any.js @@ -0,0 +1,11 @@ +// META: title=test WebNN API expand operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand + +// reuse buildReshape method +testWebNNOperation('expand', buildReshape, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/gather.https.any.js b/testing/web-platform/tests/webnn/gpu/gather.https.any.js new file mode 100644 index 0000000000..7c8a685c5c --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/gather.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API gather operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather + +testWebNNOperation('gather', buildOperationWithTwoInputs, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/gemm.https.any.js b/testing/web-platform/tests/webnn/gpu/gemm.https.any.js new file mode 100644 index 0000000000..a19dc39bbc --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/gemm.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('gemm', buildGemm, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/hard_sigmoid.https.any.js b/testing/web-platform/tests/webnn/gpu/hard_sigmoid.https.any.js new file mode 100644 index 0000000000..b6f2f53b32 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/hard_swish.https.any.js b/testing/web-platform/tests/webnn/gpu/hard_swish.https.any.js new file mode 100644 index 0000000000..a1731490bd --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/instance_normalization.https.any.js b/testing/web-platform/tests/webnn/gpu/instance_normalization.https.any.js new file mode 100644 index 0000000000..e1d73de387 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/instance_normalization.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API instanceNormalization operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-instancenorm + +testWebNNOperation('instanceNormalization', buildLayerNorm, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/layer_normalization.https.any.js b/testing/web-platform/tests/webnn/gpu/layer_normalization.https.any.js new file mode 100644 index 0000000000..1deb43bee5 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/layer_normalization.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API layerNormalization operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-layernorm + +testWebNNOperation('layerNormalization', buildLayerNorm, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/leaky_relu.https.any.js b/testing/web-platform/tests/webnn/gpu/leaky_relu.https.any.js new file mode 100644 index 0000000000..f3a7bd8ba5 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/linear.https.any.js b/testing/web-platform/tests/webnn/gpu/linear.https.any.js new file mode 100644 index 0000000000..48b8d82c1e --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/matmul.https.any.js b/testing/web-platform/tests/webnn/gpu/matmul.https.any.js new file mode 100644 index 0000000000..01fed04e3d --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/pad.https.any.js b/testing/web-platform/tests/webnn/gpu/pad.https.any.js new file mode 100644 index 0000000000..26d1bf0f38 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/pad.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('pad', buildPad, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/pooling.https.any.js b/testing/web-platform/tests/webnn/gpu/pooling.https.any.js new file mode 100644 index 0000000000..ab12881881 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/prelu.https.any.js b/testing/web-platform/tests/webnn/gpu/prelu.https.any.js new file mode 100644 index 0000000000..5a1580e662 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/reduction.https.any.js b/testing/web-platform/tests/webnn/gpu/reduction.https.any.js new file mode 100644 index 0000000000..69f9b64df4 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu' +); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/relu.https.any.js b/testing/web-platform/tests/webnn/gpu/relu.https.any.js new file mode 100644 index 0000000000..dc09846e3b --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/reshape.https.any.js b/testing/web-platform/tests/webnn/gpu/reshape.https.any.js new file mode 100644 index 0000000000..e5145e2403 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/reshape.https.any.js @@ -0,0 +1,11 @@ +// 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 + +testWebNNOperation('reshape', buildReshape, 'gpu'); + diff --git a/testing/web-platform/tests/webnn/gpu/sigmoid.https.any.js b/testing/web-platform/tests/webnn/gpu/sigmoid.https.any.js new file mode 100644 index 0000000000..6c85f5b303 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/slice.https.any.js b/testing/web-platform/tests/webnn/gpu/slice.https.any.js new file mode 100644 index 0000000000..98e5f422da --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/slice.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('slice', buildSlice, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/softmax.https.any.js b/testing/web-platform/tests/webnn/gpu/softmax.https.any.js new file mode 100644 index 0000000000..9170dd0e14 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/softplus.https.any.js b/testing/web-platform/tests/webnn/gpu/softplus.https.any.js new file mode 100644 index 0000000000..a61e5beaef --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/softplus.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API softplus operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softplus + +testWebNNOperation('softplus', buildOperationWithSingleInput, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/softsign.https.any.js b/testing/web-platform/tests/webnn/gpu/softsign.https.any.js new file mode 100644 index 0000000000..f598cbfcef --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/split.https.any.js b/testing/web-platform/tests/webnn/gpu/split.https.any.js new file mode 100644 index 0000000000..8eecd76fa1 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/split.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('split', buildSplit, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/tanh.https.any.js b/testing/web-platform/tests/webnn/gpu/tanh.https.any.js new file mode 100644 index 0000000000..15a9eeb013 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/transpose.https.any.js b/testing/web-platform/tests/webnn/gpu/transpose.https.any.js new file mode 100644 index 0000000000..074e18a488 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/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, 'gpu'); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/gpu/where.https.any.js b/testing/web-platform/tests/webnn/gpu/where.https.any.js new file mode 100644 index 0000000000..ec0c5530a0 --- /dev/null +++ b/testing/web-platform/tests/webnn/gpu/where.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API where operation +// META: global=window,dedicatedworker +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-where + +testWebNNOperation('where', buildWhere, 'gpu'); \ 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..65e21d5a1d --- /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', {dataType: 'float32', dimensions: [1, 1, 5, 5]}); + self.filter = builder.constant({dataType: '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/instance_normalization.https.any.js b/testing/web-platform/tests/webnn/instance_normalization.https.any.js new file mode 100644 index 0000000000..0b7a708917 --- /dev/null +++ b/testing/web-platform/tests/webnn/instance_normalization.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API instanceNormalization operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-instancenorm + +testWebNNOperation('instanceNormalization', buildLayerNorm); \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/layer_normalization.https.any.js b/testing/web-platform/tests/webnn/layer_normalization.https.any.js new file mode 100644 index 0000000000..380db4ea52 --- /dev/null +++ b/testing/web-platform/tests/webnn/layer_normalization.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API layerNormalization operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-layernorm + +testWebNNOperation('layerNormalization', buildLayerNorm); \ No newline at end of file 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..05eec653c6 --- /dev/null +++ b/testing/web-platform/tests/webnn/pad.https.any.js @@ -0,0 +1,10 @@ +// 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 + +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..e0733635f8 --- /dev/null +++ b/testing/web-platform/tests/webnn/reshape.https.any.js @@ -0,0 +1,11 @@ +// 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 + +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..d665da6bb4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/abs.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "abs float32 1D constant 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", + "constant": true + } + }, + "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 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..dba361228b --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/add.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "add float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "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 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/arg_max.json b/testing/web-platform/tests/webnn/resources/test_data/arg_max.json new file mode 100644 index 0000000000..d2fe9e62ca --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/arg_max.json @@ -0,0 +1,963 @@ +{ + "tests": [ + { + "name": "argMax float32 1D constant tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[2]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 1, 3], + "data": [ + 1, + 2, + 2, + 1, + 2, + 2 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [] + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "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": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 20 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 3 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[0, 2] options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "keepDimensions": false + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 1, + 2, + 2 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[3, 0, 1] options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 4, 1], + "data": [ + 2, + 0, + 2, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[0, 2] options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 1, + 2, + 2 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[0, 2] options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 5, + 6, + 6 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [4], + "data": [ + 2, + 0, + 2, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [4], + "data": [ + 5, + 3, + 5, + 4 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 4D tensor all options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955, + -51.0936194154457, + -6.5397018645619625, + 73.81338015899149, + 88.46114630531724, + -5.294266751122791, + -79.20668057325759, + -41.70176598864654, + 73.81338015899149, + 88.46114630531724, + -84.939998758247, + -61.488942502520906, + -98.33874402761955 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0], + "keepDimensions": true, + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [1, 1, 4, 1], + "data": [ + 2, + 0, + 2, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 0D scalar options.axes=[]", + "inputs": { + "input": { + "shape": [], + "data": [ + -51.0936194154457 + ], + "type": "float32" + } + }, + "options": { + "axes": [] + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "int64" + } + }, + { + "name": "argMax float32 0D scalar options.axes=[] no effect by both keepDimensions and selectLastIndex being true", + "inputs": { + "input": { + "shape": [], + "data": [ + -51.0936194154457 + ], + "type": "float32" + } + }, + "options": { + "axes": [], + "keepDimensions": true, + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "int64" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/arg_min.json b/testing/web-platform/tests/webnn/resources/test_data/arg_min.json new file mode 100644 index 0000000000..132a2dc3e8 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/arg_min.json @@ -0,0 +1,963 @@ +{ + "tests": [ + { + "name": "argMin float32 1D constant tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 1D tensor default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[2]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 1, 3], + "data": [ + 2, + 2, + 0, + 0, + 0, + 0 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [] + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "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": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 19 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 7 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[0, 2] options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "keepDimensions": false + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 2, + 2, + 4 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[3, 0, 1] options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 4, 1], + "data": [ + 4, + 0, + 1, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[0, 2] options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 2, + 2, + 4 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[0, 2] options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2], + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [1, 3], + "data": [ + 6, + 6, + 4 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=false", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [4], + "data": [ + 4, + 0, + 1, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=true", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0, 1], + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [4], + "data": [ + 4, + 0, + 4, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 4D tensor all options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + 3.830124090690262, + -24.986487937638074, + 5.299982630691289, + -48.5486590218902, + 40.30886781808215, + 60.184293919409726, + -82.78385618759043, + -96.50904103637833, + 71.87028201591897, + 38.866394268784035, + -39.143725517854435, + 31.444366685561903, + -82.78385618759043, + -96.50904103637833, + -25.53388886326502, + -16.142265850469343, + 66.63677406472371, + 82.5119815304117, + -82.78385618759043, + -96.50904103637833, + 39.7687246127592, + 42.15040238450999, + 82.66863662444459, + 85.4526923278379 + ], + "type": "float32" + } + }, + "options": { + "axes": [3, 0], + "keepDimensions": true, + "selectLastIndex": false + }, + "expected": { + "name": "output", + "shape": [1, 1, 4, 1], + "data": [ + 4, + 0, + 1, + 1 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 0D scalar options.axes=[]", + "inputs": { + "input": { + "shape": [], + "data": [ + 3.830124090690262 + ], + "type": "float32" + } + }, + "options": { + "axes": [] + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "int64" + } + }, + { + "name": "argMin float32 0D scalar options.axes=[] no effect by both keepDimensions and selectLastIndex being true", + "inputs": { + "input": { + "shape": [], + "data": [ + 3.830124090690262 + ], + "type": "float32" + } + }, + "options": { + "axes": [], + "keepDimensions": true, + "selectLastIndex": true + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "int64" + } + } + ] +} \ 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..5a9f4e28b1 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/average_pool2d.json @@ -0,0 +1,1684 @@ +{ + "tests": [ + { + "name": "averagePool2d float32 4D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 47.26926803588867, + 44.72445297241211 + ], + "type": "float32" + } + }, + { + "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.layout=nhwc and options.roundingType=floor", + "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": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "layout": "nhwc", + "roundingType": "floor" + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 2], + "data": [ + 54.20252990722656, + 52.73374557495117, + 37.16582489013672, + 39.1442985534668, + 50.038944244384766, + 43.23125457763672, + 58.46046447753906, + 32.67961120605469 + ], + "type": "float32" + } + }, + { + "name": "averagePool2d float32 4D tensor options.layout=nhwc and options.roundingType=ceil", + "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": { + "windowDimensions": [3, 3], + "padding": [1, 0, 0, 1], + "strides": [2, 2], + "layout": "nhwc", + "roundingType": "ceil" + }, + "expected": { + "name": "output", + "shape": [1, 3, 3, 2], + "data": [ + 54.20252990722656, + 52.73374557495117, + 37.16582489013672, + 39.1442985534668, + 21.206613540649414, + 57.1103515625, + 50.038944244384766, + 43.23125457763672, + 58.46046447753906, + 32.67961120605469, + 51.3569221496582, + 56.23945999145508, + 37.24428939819336, + 40.00800323486328, + 54.04661178588867, + 43.85149002075195, + 78.58363342285156, + 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..04ab0d0d6f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/batch_normalization.json @@ -0,0 +1,1181 @@ +{ + "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 constant 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", + "constant": true + }, + "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 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/cast.json b/testing/web-platform/tests/webnn/resources/test_data/cast.json new file mode 100644 index 0000000000..59d1036eee --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/cast.json @@ -0,0 +1,3040 @@ +{ + "tests": [ + { + "name": "cast float32 0D tensor to int32", + "inputs": { + "input": { + "shape": [], + "data": [ + 84.77753448486328 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [], + "data": [ + 84 + ], + "type": "int32" + } + }, + { + "name": "cast float32 1D tensor to int32", + "inputs": { + "input": { + "shape": [24], + "data": [ + 102.1578369140625, + -43.5, + 52.84621810913086, + -99.9583511352539, + 6.729493141174316, + 92.66157531738281, + -10.377813339233398, + 106.65289306640625, + -7.126272678375244, + 91.51563262939453, + -50.87134552001953, + 83.38890075683594, + 72.9759750366211, + -31.015382766723633, + 79.94034576416016, + 41.5, + 35.727149963378906, + -2.5, + -96.05252838134766, + -86.76212310791016, + -27.49382972717285, + -23.836687088012695, + 70.77123260498047, + 83.5 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [24], + "data": [ + 102, + -43, + 52, + -99, + 6, + 92, + -10, + 106, + -7, + 91, + -50, + 83, + 72, + -31, + 79, + 41, + 35, + -2, + -96, + -86, + -27, + -23, + 70, + 83 + ], + "type": "int32" + } + }, + { + "name": "cast float32 2D tensor to int32", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 102.1578369140625, + -43.5, + 52.84621810913086, + -99.9583511352539, + 6.729493141174316, + 92.66157531738281, + -10.377813339233398, + 106.65289306640625, + -7.126272678375244, + 91.51563262939453, + -50.87134552001953, + 83.38890075683594, + 72.9759750366211, + -31.015382766723633, + 79.94034576416016, + 41.5, + 35.727149963378906, + -2.5, + -96.05252838134766, + -86.76212310791016, + -27.49382972717285, + -23.836687088012695, + 70.77123260498047, + 83.5 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 102, + -43, + 52, + -99, + 6, + 92, + -10, + 106, + -7, + 91, + -50, + 83, + 72, + -31, + 79, + 41, + 35, + -2, + -96, + -86, + -27, + -23, + 70, + 83 + ], + "type": "int32" + } + }, + { + "name": "cast float32 3D tensor to int32", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 102.1578369140625, + -43.5, + 52.84621810913086, + -99.9583511352539, + 6.729493141174316, + 92.66157531738281, + -10.377813339233398, + 106.65289306640625, + -7.126272678375244, + 91.51563262939453, + -50.87134552001953, + 83.38890075683594, + 72.9759750366211, + -31.015382766723633, + 79.94034576416016, + 41.5, + 35.727149963378906, + -2.5, + -96.05252838134766, + -86.76212310791016, + -27.49382972717285, + -23.836687088012695, + 70.77123260498047, + 83.5 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 102, + -43, + 52, + -99, + 6, + 92, + -10, + 106, + -7, + 91, + -50, + 83, + 72, + -31, + 79, + 41, + 35, + -2, + -96, + -86, + -27, + -23, + 70, + 83 + ], + "type": "int32" + } + }, + { + "name": "cast float32 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + -43.5, + 52.84621810913086, + -99.9583511352539, + 6.729493141174316, + 92.66157531738281, + -10.377813339233398, + 106.65289306640625, + -7.126272678375244, + 91.51563262939453, + -50.87134552001953, + 83.38890075683594, + 72.9759750366211, + -31.015382766723633, + 79.94034576416016, + 41.5, + 35.727149963378906, + -2.5, + -96.05252838134766, + -86.76212310791016, + -27.49382972717285, + -23.836687088012695, + 70.77123260498047, + 83.5 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 102, + -43, + 52, + -99, + 6, + 92, + -10, + 106, + -7, + 91, + -50, + 83, + 72, + -31, + 79, + 41, + 35, + -2, + -96, + -86, + -27, + -23, + 70, + 83 + ], + "type": "int32" + } + }, + { + "name": "cast float32 5D tensor to int32", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 102.1578369140625, + -43.5, + 52.84621810913086, + -99.9583511352539, + 6.729493141174316, + 92.66157531738281, + -10.377813339233398, + 106.65289306640625, + -7.126272678375244, + 91.51563262939453, + -50.87134552001953, + 83.38890075683594, + 72.9759750366211, + -31.015382766723633, + 79.94034576416016, + 41.5, + 35.727149963378906, + -2.5, + -96.05252838134766, + -86.76212310791016, + -27.49382972717285, + -23.836687088012695, + 70.77123260498047, + 83.5 + ], + "type": "float32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 102, + -43, + 52, + -99, + 6, + 92, + -10, + 106, + -7, + 91, + -50, + 83, + 72, + -31, + 79, + 41, + 35, + -2, + -96, + -86, + -27, + -23, + 70, + 83 + ], + "type": "int32" + } + }, + { + "name": "cast float32 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + 43.60371780395508, + 52.84621810913086, + 99.9583511352539, + 6.729493141174316, + 92.66157531738281, + 10.377813339233398, + 106.65289306640625, + 7.126272678375244, + 91.51563262939453, + 50.87134552001953, + 83.38890075683594, + 72.9759750366211, + 31.015382766723633, + 79.94034576416016, + 41.844703674316406, + 35.727149963378906, + 2.614182949066162, + 96.05252838134766, + 86.76212310791016, + 27.49382972717285, + 23.836687088012695, + 70.77123260498047, + 83.8347396850586 + ], + "type": "float32" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 102.1875, + 43.59375, + 52.84375, + 99.9375, + 6.73046875, + 92.6875, + 10.375, + 106.625, + 7.125, + 91.5, + 50.875, + 83.375, + 73, + 31.015625, + 79.9375, + 41.84375, + 35.71875, + 2.61328125, + 96.0625, + 86.75, + 27.5, + 23.84375, + 70.75, + 83.8125 + ], + "type": "float16" + } + }, + { + "name": "cast float32 4D tensor to uint32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + 43.60371780395508, + 52.84621810913086, + 99.9583511352539, + 6.729493141174316, + 92.66157531738281, + 10.377813339233398, + 106.65289306640625, + 7.126272678375244, + 91.51563262939453, + 50.87134552001953, + 83.38890075683594, + 72.9759750366211, + 31.015382766723633, + 79.94034576416016, + 41.844703674316406, + 35.727149963378906, + 2.614182949066162, + 96.05252838134766, + 86.76212310791016, + 27.49382972717285, + 23.836687088012695, + 70.77123260498047, + 83.8347396850586 + ], + "type": "float32" + } + }, + "type": "uint32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 102, + 43, + 52, + 99, + 6, + 92, + 10, + 106, + 7, + 91, + 50, + 83, + 72, + 31, + 79, + 41, + 35, + 2, + 96, + 86, + 27, + 23, + 70, + 83 + ], + "type": "uint32" + } + }, + { + "name": "cast float32 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + 43.60371780395508, + 52.84621810913086, + 99.9583511352539, + 6.729493141174316, + 92.66157531738281, + 10.377813339233398, + 106.65289306640625, + 7.126272678375244, + 91.51563262939453, + 50.87134552001953, + 83.38890075683594, + 72.9759750366211, + 31.015382766723633, + 79.94034576416016, + 41.844703674316406, + 35.727149963378906, + 2.614182949066162, + 96.05252838134766, + 86.76212310791016, + 27.49382972717285, + 23.836687088012695, + 70.77123260498047, + 83.8347396850586 + ], + "type": "float32" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "102", + "43", + "52", + "99", + "6", + "92", + "10", + "106", + "7", + "91", + "50", + "83", + "72", + "31", + "79", + "41", + "35", + "2", + "96", + "86", + "27", + "23", + "70", + "83" + ], + "type": "int64" + } + }, + { + "name": "cast float32 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + 43.60371780395508, + 52.84621810913086, + 99.9583511352539, + 6.729493141174316, + 92.66157531738281, + 10.377813339233398, + 106.65289306640625, + 7.126272678375244, + 91.51563262939453, + 50.87134552001953, + 83.38890075683594, + 72.9759750366211, + 31.015382766723633, + 79.94034576416016, + 41.844703674316406, + 35.727149963378906, + 2.614182949066162, + 96.05252838134766, + 86.76212310791016, + 27.49382972717285, + 23.836687088012695, + 70.77123260498047, + 83.8347396850586 + ], + "type": "float32" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 102, + 43, + 52, + 99, + 6, + 92, + 10, + 106, + 7, + 91, + 50, + 83, + 72, + 31, + 79, + 41, + 35, + 2, + 96, + 86, + 27, + 23, + 70, + 83 + ], + "type": "int8" + } + }, + { + "name": "cast float32 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 102.1578369140625, + 43.60371780395508, + 52.84621810913086, + 99.9583511352539, + 6.729493141174316, + 92.66157531738281, + 10.377813339233398, + 106.65289306640625, + 7.126272678375244, + 91.51563262939453, + 50.87134552001953, + 83.38890075683594, + 72.9759750366211, + 31.015382766723633, + 79.94034576416016, + 41.844703674316406, + 35.727149963378906, + 2.614182949066162, + 96.05252838134766, + 86.76212310791016, + 27.49382972717285, + 23.836687088012695, + 70.77123260498047, + 83.8347396850586 + ], + "type": "float32" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 102, + 43, + 52, + 99, + 6, + 92, + 10, + 106, + 7, + 91, + 50, + 83, + 72, + 31, + 79, + 41, + 35, + 2, + 96, + 86, + 27, + 23, + 70, + 83 + ], + "type": "uint8" + } + }, + { + "name": "cast float16 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float32" + } + }, + { + "name": "cast float16 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 3, + 32, + 62, + 51, + 87, + 106, + 125, + 112, + 70, + 39, + 10, + 21, + 99, + 16, + 115, + 66, + 49, + 115, + 77, + 57, + 61, + 12, + 101, + 123 + ], + "type": "int32" + } + }, + { + "name": "cast float16 4D tensor to uint32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "uint32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 3, + 32, + 62, + 51, + 87, + 106, + 125, + 112, + 70, + 39, + 10, + 21, + 99, + 16, + 115, + 66, + 49, + 115, + 77, + 57, + 61, + 12, + 101, + 123 + ], + "type": "uint32" + } + }, + { + "name": "cast float16 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "3", + "32", + "62", + "51", + "87", + "106", + "125", + "112", + "70", + "39", + "10", + "21", + "99", + "16", + "115", + "66", + "49", + "115", + "77", + "57", + "61", + "12", + "101", + "123" + ], + "type": "int64" + } + }, + { + "name": "cast float16 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 3, + 32, + 62, + 51, + 87, + 106, + 125, + 112, + 70, + 39, + 10, + 21, + 99, + 16, + 115, + 66, + 49, + 115, + 77, + 57, + 61, + 12, + 101, + 123 + ], + "type": "int8" + } + }, + { + "name": "cast float16 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 3.103515625, + 32.40625, + 62.15625, + 51.75, + 87.0625, + 106.25, + 125.375, + 112.9375, + 70.8125, + 39.1875, + 10.3515625, + 21.234375, + 99.75, + 16.125, + 115.625, + 66, + 49.375, + 115.75, + 77, + 57.15625, + 61.6875, + 12.9296875, + 101.25, + 123.9375 + ], + "type": "float16" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 3, + 32, + 62, + 51, + 87, + 106, + 125, + 112, + 70, + 39, + 10, + 21, + 99, + 16, + 115, + 66, + 49, + 115, + 77, + 57, + 61, + 12, + 101, + 123 + ], + "type": "uint8" + } + }, + { + "name": "cast int32 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int32" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "float32" + } + }, + { + "name": "cast int32 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int32" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "float16" + } + }, + { + "name": "cast int32 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int32" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "45", + "55", + "11", + "21", + "78", + "104", + "102", + "66", + "41", + "110", + "92", + "69", + "48", + "23", + "58", + "12", + "33", + "24", + "101", + "87", + "49", + "118", + "1", + "77" + ], + "type": "int64" + } + }, + { + "name": "cast int32 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int32" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int8" + } + }, + { + "name": "cast int32 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "int32" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 45, + 55, + 11, + 21, + 78, + 104, + 102, + 66, + 41, + 110, + 92, + 69, + 48, + 23, + 58, + 12, + 33, + 24, + 101, + 87, + 49, + 118, + 1, + 77 + ], + "type": "uint8" + } + }, + { + "name": "cast uint32 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "float32" + } + }, + { + "name": "cast uint32 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "float16" + } + }, + { + "name": "cast uint32 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "int32" + } + }, + { + "name": "cast uint32 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "34", + "83", + "113", + "31", + "62", + "80", + "8", + "40", + "104", + "42", + "6", + "91", + "93", + "21", + "40", + "21", + "51", + "110", + "115", + "12", + "122", + "68", + "57", + "72" + ], + "type": "int64" + } + }, + { + "name": "cast uint32 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "int8" + } + }, + { + "name": "cast uint32 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint32" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 34, + 83, + 113, + 31, + 62, + 80, + 8, + 40, + 104, + 42, + 6, + 91, + 93, + 21, + 40, + 21, + 51, + 110, + 115, + 12, + 122, + 68, + 57, + 72 + ], + "type": "uint8" + } + }, + { + "name": "cast int64 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "float32" + } + }, + { + "name": "cast int64 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "float16" + } + }, + { + "name": "cast int64 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "int32" + } + }, + { + "name": "cast int64 4D tensor to uint32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "uint32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "uint32" + } + }, + { + "name": "cast int64 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "int8" + } + }, + { + "name": "cast int64 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + "50", + "1", + "28", + "20", + "102", + "86", + "70", + "38", + "50", + "19", + "11", + "4", + "56", + "77", + "40", + "80", + "45", + "127", + "4", + "87", + "125", + "26", + "63", + "11" + ], + "type": "int64" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 50, + 1, + 28, + 20, + 102, + 86, + 70, + 38, + 50, + 19, + 11, + 4, + 56, + 77, + 40, + 80, + 45, + 127, + 4, + 87, + 125, + 26, + 63, + 11 + ], + "type": "uint8" + } + }, + { + "name": "cast int8 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "float32" + } + }, + { + "name": "cast int8 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "float16" + } + }, + { + "name": "cast int8 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int32" + } + }, + { + "name": "cast int8 4D tensor to uint32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "uint32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "uint32" + } + }, + { + "name": "cast int8 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "123", + "17", + "31", + "77", + "88", + "44", + "84", + "40", + "14", + "64", + "109", + "4", + "2", + "0", + "45", + "47", + "72", + "88", + "82", + "4", + "73", + "36", + "65", + "117" + ], + "type": "int64" + } + }, + { + "name": "cast int8 4D tensor to uint8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "int8" + } + }, + "type": "uint8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 123, + 17, + 31, + 77, + 88, + 44, + 84, + 40, + 14, + 64, + 109, + 4, + 2, + 0, + 45, + 47, + 72, + 88, + 82, + 4, + 73, + 36, + 65, + 117 + ], + "type": "uint8" + } + }, + { + "name": "cast uint8 4D tensor to float32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "float32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "float32" + } + }, + { + "name": "cast uint8 4D tensor to float16", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "float16", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "float16" + } + }, + { + "name": "cast uint8 4D tensor to int32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "int32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "int32" + } + }, + { + "name": "cast uint8 4D tensor to uint32", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "uint32", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint32" + } + }, + { + "name": "cast uint8 4D tensor to int64", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "int64", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + "10", + "112", + "121", + "120", + "22", + "105", + "41", + "30", + "75", + "121", + "55", + "47", + "121", + "24", + "16", + "33", + "97", + "24", + "3", + "37", + "45", + "6", + "56", + "57" + ], + "type": "int64" + } + }, + { + "name": "cast uint8 4D tensor to int8", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "uint8" + } + }, + "type": "int8", + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 10, + 112, + 121, + 120, + 22, + 105, + 41, + 30, + 75, + 121, + 55, + 47, + 121, + 24, + 16, + 33, + 97, + 24, + 3, + 37, + 45, + 6, + 56, + 57 + ], + "type": "int8" + } + } + ] +} \ 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..b9bccbc3a0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/ceil.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "ceil float32 1D constant 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", + "constant": true + } + }, + "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 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..0e948f9931 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/clamp.json @@ -0,0 +1,1169 @@ +{ + "tests": [ + // default options + { + "name": "clamp float32 1D constant 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", + "constant": true + } + }, + "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 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..5e2285b75a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/concat.json @@ -0,0 +1,3666 @@ +{ + "tests": [ + // concat 1D tensors + { + "name": "concat two float32 1D constant 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", + "constant": true + }, + { + "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", + "constant": true + } + ], + "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 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 two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 three float16 1D tensors of different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [4], + "data": [ + -0.39444134019222243, + 0.8619825316530809, + 0.3379962524218807, + -0.9906398615400507 + ], + "type": "float16" + }, + { + "name": "input2", + "shape": [8], + "data": [ + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 float16 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": "float16" + }, + { + "name": "input2", + "shape": [6], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [6], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float16" + }, + { + "name": "input4", + "shape": [6], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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" + } + }, + { + "name": "concat four float16 1D tensors of different 1st dimension along axis 0", + "inputs": [ + { + "name": "input1", + "shape": [2], + "data": [ + -0.39444134019222243, + 0.8619825316530809 + ], + "type": "float16" + }, + { + "name": "input2", + "shape": [4], + "data": [ + 0.3379962524218807, + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [8], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976 + ], + "type": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + // 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 float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 four float16 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": "float16" + }, + { + "name": "input2", + "shape": [3, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [3, 2], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float16" + }, + { + "name": "input4", + "shape": [3, 2], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [12, 2], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 two float16 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": "float16" + }, + { + "name": "input2", + "shape": [2, 2], + "data": [ + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [2, 12], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + 0.51806640625, + -0.8740234375, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 three float16 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": "float16" + }, + { + "name": "input2", + "shape": [4, 2], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [4, 2], + "data": [ + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.39453125, + 0.86181640625, + -0.5947265625, + -0.40283203125, + -0.720703125, + -0.79931640625, + 0.337890625, + -0.99072265625, + -0.953125, + -0.67333984375, + 0.66552734375, + 0.038848876953125, + 0.57666015625, + 0.32275390625, + 0.491943359375, + -0.15869140625, + 0.51806640625, + -0.8740234375, + -0.447265625, + 0.11029052734375, + -0.341796875, + -0.916015625, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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" + } + }, + { + "name": "concat four float16 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": "float16" + }, + { + "name": "input2", + "shape": [3, 2], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [3, 2], + "data": [ + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157 + ], + "type": "float16" + }, + { + "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": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [3, 8], + "data": [ + -0.39453125, + -0.99072265625, + 0.57666015625, + -0.40283203125, + -0.953125, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.86181640625, + 0.32275390625, + -0.447265625, + -0.67333984375, + 0.491943359375, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + 0.337890625, + 0.11029052734375, + -0.5947265625, + -0.15869140625, + -0.341796875, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + // 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 two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [8, 1, 3], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 four float16 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": "float16" + }, + { + "name": "input2", + "shape": [3, 2, 1], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237, + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [3, 2, 1], + "data": [ + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157 + ], + "type": "float16" + }, + { + "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": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [3, 8, 1], + "data": [ + -0.39453125, + -0.99072265625, + 0.57666015625, + -0.40283203125, + -0.953125, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.86181640625, + 0.32275390625, + -0.447265625, + -0.67333984375, + 0.491943359375, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + 0.337890625, + 0.11029052734375, + -0.5947265625, + -0.15869140625, + -0.341796875, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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" + } + }, + { + "name": "concat three float16 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": "float16" + }, + { + "name": "input2", + "shape": [2, 2, 2], + "data": [ + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844, + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [2, 2, 2], + "data": [ + -0.7206121708970712, + -0.7993468785008635, + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [2, 2, 6], + "data": [ + -0.39453125, + 0.86181640625, + -0.5947265625, + -0.40283203125, + -0.720703125, + -0.79931640625, + 0.337890625, + -0.99072265625, + -0.953125, + -0.67333984375, + 0.66552734375, + 0.038848876953125, + 0.57666015625, + 0.32275390625, + 0.491943359375, + -0.15869140625, + 0.51806640625, + -0.8740234375, + -0.447265625, + 0.11029052734375, + -0.341796875, + -0.916015625, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + // 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 two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 3, 1, 2], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 float16 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": "float16" + }, + { + "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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [2, 6, 1, 2], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 three float16 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": "float16" + }, + { + "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": "float16" + }, + { + "name": "input3", + "shape": [1, 2, 2, 1], + "data": [ + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [1, 2, 12, 1], + "data": [ + -0.39453125, + 0.86181640625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.51806640625, + -0.8740234375, + 0.337890625, + -0.99072265625, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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" + } + }, + { + "name": "concat four float16 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": "float16" + }, + { + "name": "input2", + "shape": [1, 3, 1, 1], + "data": [ + -0.9906398615400507, + 0.576785657225761, + 0.3227640108329237 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [1, 3, 1, 2], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float16" + }, + { + "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": "float16" + } + ], + "axis": 3, + "expected": { + "name": "output", + "shape": [1, 3, 1, 8], + "data": [ + -0.39453125, + -0.99072265625, + -0.447265625, + 0.11029052734375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + 0.86181640625, + 0.57666015625, + -0.5947265625, + -0.40283203125, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.337890625, + 0.32275390625, + -0.953125, + -0.67333984375, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + // 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 four float16 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": "float16" + }, + { + "name": "input2", + "shape": [1, 2, 1, 1, 3], + "data": [ + -0.44735022799701873, + 0.11028251232581932, + -0.5945112749179908, + -0.40284849555754754, + -0.9531654171044694, + -0.6731740531810844 + ], + "type": "float16" + }, + { + "name": "input3", + "shape": [1, 2, 1, 1, 3], + "data": [ + 0.4918989118791477, + -0.15864110312378976, + -0.34188115459083157, + -0.9158143500894873, + -0.7206121708970712, + -0.7993468785008635 + ], + "type": "float16" + }, + { + "name": "input4", + "shape":[1, 2, 1, 1, 3], + "data": [ + 0.6653799854931952, + 0.03886038855553897, + 0.5182055416768865, + -0.8742016938344297, + -0.479021891130635, + 0.1211843166661235 + ], + "type": "float16" + } + ], + "axis": 0, + "expected": { + "name": "output", + "shape": [4, 2, 1, 1, 3], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 1, + "expected": { + "name": "output", + "shape": [1, 8, 3, 1, 1], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 three float16 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": "float16" + }, + { + "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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 2, + "expected": { + "name": "output", + "shape": [1, 2, 6, 1, 2], + "data": [ + -0.39453125, + 0.86181640625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.337890625, + -0.99072265625, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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 float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 3, + "expected": { + "name": "output", + "shape": [3, 1, 1, 4, 2], + "data": [ + -0.39453125, + 0.86181640625, + -0.447265625, + 0.11029052734375, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.337890625, + -0.99072265625, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + -0.720703125, + -0.79931640625, + 0.57666015625, + 0.32275390625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + }, + { + "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" + } + }, + { + "name": "concat two float16 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": "float16" + }, + { + "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": "float16" + } + ], + "axis": 4, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1, 12], + "data": [ + -0.39453125, + 0.86181640625, + 0.337890625, + -0.99072265625, + -0.5947265625, + -0.40283203125, + -0.953125, + -0.67333984375, + 0.491943359375, + -0.15869140625, + -0.341796875, + -0.916015625, + 0.57666015625, + 0.32275390625, + -0.447265625, + 0.11029052734375, + -0.720703125, + -0.79931640625, + 0.66552734375, + 0.038848876953125, + 0.51806640625, + -0.8740234375, + -0.47900390625, + 0.12115478515625 + ], + "type": "float16" + } + } + ] +} \ 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..5f8cd814a9 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/conv2d.json @@ -0,0 +1,2213 @@ +{ + "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 both input and filter 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", + "constant": true + }, + "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 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..42274e6fa3 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/conv_transpose2d.json @@ -0,0 +1,2581 @@ +{ + "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 both input and filter constant tensors default options", + "inputs": { + "input": { + "shape": [1, 1, 2, 2], + "data": [ + 0.5872158177067033, + 0.6077792328258038, + 0.01728916618181975, + 0.26146076483771563 + ], + "type": "float32", + "constant": true + }, + "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 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.groups", + "inputs": { + "input": { + "shape": [1, 2, 2, 2], + "data": [ + 0.8161798343223461, + 0.544277595043074, + 0.791066952587467, + 0.3656411302728415, + 0.2542919917049826, + 0.20815767803688034, + 0.7023073172218113, + 0.573446998515611 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 1, 2, 2], + "data": [ + 0.09232201736721923, + 0.31896016969423147, + 0.5445202353307315, + 0.65828078346301, + 0.9634372989011768, + 0.01211885979286964, + 0.9230011822371578, + 0.4781944254526862 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "groups": 2 + }, + "expected": { + "shape": [1, 2, 3, 3], + "data": [ + 0.07535136491060257, + 0.3105776607990265, + 0.1736028790473938, + 0.5174593329429626, + 1.1197212934494019, + 0.4749124348163605, + 0.4307519793510437, + 0.7198431491851807, + 0.24069452285766602, + 0.023476747795939445, + 0.1003265455365181, + 0.06639400124549866, + 0.20330555737018585, + 0.5576914548873901, + 0.3199329376220703, + 0.3824205696582794, + 0.7745689153671265, + 0.3774891495704651 + ], + "type": "float32" + } + }, + { + "name": "convTranspose2d float32 4D input and filter tensors options.groups=2 options.strides=[2, 2]", + "inputs": { + "input": { + "shape": [1, 2, 2, 2], + "data": [ + 0.8161798343223461, + 0.544277595043074, + 0.791066952587467, + 0.3656411302728415, + 0.2542919917049826, + 0.20815767803688034, + 0.7023073172218113, + 0.573446998515611 + ], + "type": "float32" + }, + "filter": { + "shape": [2, 1, 2, 2], + "data": [ + 0.09232201736721923, + 0.31896016969423147, + 0.5445202353307315, + 0.65828078346301, + 0.9634372989011768, + 0.01211885979286964, + 0.9230011822371578, + 0.4781944254526862 + ], + "type": "float32", + "constant": true + } + }, + "options": { + "groups": 2, + "strides": [2, 2] + }, + "expected": { + "shape": [1, 2, 4, 4], + "data": [ + 0.07535136491060257, + 0.26032882928848267, + 0.050248805433511734, + 0.1736028790473938, + 0.44442644715309143, + 0.537275493144989, + 0.29637017846107483, + 0.3582874834537506, + 0.07303289324045181, + 0.2523188292980194, + 0.03375672549009323, + 0.11662495136260986, + 0.4307519793510437, + 0.5207441449165344, + 0.19909898936748505, + 0.24069452285766602, + 0.023476747795939445, + 0.08110900968313217, + 0.019217535853385925, + 0.06639400124549866, + 0.13846713304519653, + 0.16739553213119507, + 0.11334607005119324, + 0.13702619075775146, + 0.06483843177556992, + 0.22400806844234467, + 0.05294178053736687, + 0.18290674686431885, + 0.3824205696582794, + 0.4623154401779175, + 0.31225350499153137, + 0.3774891495704651 + ], + "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.inputLayout=nhwc options.filterLayout=iohw", + "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", + "filterLayout": "iohw" + }, + "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.inputLayout=nhwc options.filterLayout=hwoi", + "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": [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": { + "inputLayout": "nhwc", + "filterLayout": "hwoi" + }, + "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.inputLayout=nhwc options.filterLayout=ohwi", + "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": [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": { + "inputLayout": "nhwc", + "filterLayout": "ohwi" + }, + "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.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..db7ade11e3 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/cos.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "cos float32 1D constant 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", + "constant": true + } + }, + "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 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..a60341181d --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/div.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "div float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "expected": { + "name": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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..b1c443282e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/elu.json @@ -0,0 +1,539 @@ +{ // elu: The calculation follows the expression max(0, x) + alpha * (exp(min(0, x)) - 1). + "tests": [ + { + "name": "elu float32 1D constant 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", + "constant": true + } + }, + "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 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/equal.json b/testing/web-platform/tests/webnn/resources/test_data/equal.json new file mode 100644 index 0000000000..bbd9143a03 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/equal.json @@ -0,0 +1,982 @@ +{ + "tests": [ + { + "name": "equal float32 0D scalar", + "inputs": { + "a": { + "shape": [], + "data": [ + -0.6285496901988363 + ], + "type": "float32" + }, + "b": { + "shape": [], + "data": [ + -4.416641209564136 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 1D constant tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [24], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.839719707803649, + 4.996258886261531, + 0.9727277518275201, + -6.173707599765419, + 2.8057064434130865, + 5.588105051769192, + 7.767369675510874, + -4.308908126069415, + -5.895479626582176, + -8.532091541161986, + 2.8057064434130865, + 5.588105051769192, + 0.17833953390240076, + -4.479541639848148, + 0.6819732148052395, + -6.687512654244134, + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + -1.972828107164485, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2, 3], + "data": [ + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 broadcast 0D to 4D", + "inputs": { + "a": { + "shape": [], + "data": [ + 2.8057064434130865 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 2.8057064434130865 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -4.9622954777657835, + -2.863192149827909, + -3.011512276155144, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 2.8057064434130865, + 5.588105051769192, + -9.041799605912026, + 3.6268343183100704 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "equal float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 2.8057064434130865 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 2.8057064434130865, + 5.588105051769192, + 2.8552264057573318, + 4.996258886261531, + 0.9727277518275201, + -4.7425998673234115, + 2.8057064434130865, + 5.588105051769192, + -5.107602083264831, + 6.62414218944782, + -2.320724650141428, + -7.053896009779472, + 2.8057064434130865, + 5.588105051769192, + 4.980423911313675, + -5.440841218751173, + 1.1459590058073985, + 7.774532655736756, + 2.8057064434130865, + 5.588105051769192, + -6.245251018074902, + -2.849073058101119, + -2.6951117252164236, + 5.8175630540970715 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/erf.json b/testing/web-platform/tests/webnn/resources/test_data/erf.json new file mode 100644 index 0000000000..6f0b550cf7 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/erf.json @@ -0,0 +1,421 @@ +{ + "tests": [ + { + "name": "erf float32 0D scalar", + "inputs": { + "input": { + "shape": [], + "data": [ + -0.004352752727565523 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + -0.004911554511636496 + ], + "type": "float32" + } + }, + { + "name": "erf float32 1D constant tensor", + "inputs": { + "input": { + "shape": [24], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "type": "float32" + } + }, + { + "name": "erf float32 1D tensor", + "inputs": { + "input": { + "shape": [24], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "type": "float32" + } + }, + { + "name": "erf float32 2D tensor", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "type": "float32" + } + }, + { + "name": "erf float32 3D tensor", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "type": "float32" + } + }, + { + "name": "erf float32 4D tensor", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "type": "float32" + } + }, + { + "name": "erf float32 5D tensor", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.5883062462825124, + -0.5323766618091814, + 0.127987056070479, + 0.5772181473181615, + 0.9045778906827358, + -0.49856746753516346, + 0.9843886624146143, + 0.21642259286228738, + 0.25235170684373465, + -0.14916697974435467, + 0.9136939573458718, + -0.5736439986742754, + 0.740446832641029, + 0.5202203195176929, + -0.16549504687505712, + 0.8005731834523444, + 0.4001320000966242, + -0.7489422658248586, + -0.8946002438575227, + -0.392025619231934, + 0.6854220843685903, + -0.674490045974586, + -0.4398081957860396, + 0.2709762572248531 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.5945858955383301, + -0.5484867095947266, + 0.14363321661949158, + 0.5856771469116211, + 0.7991966009140015, + -0.5192402005195618, + 0.8361185789108276, + 0.2404468059539795, + 0.27881762385368347, + -0.16707675158977509, + 0.8036975860595703, + -0.5827808976173401, + 0.7049695253372192, + 0.5380884408950806, + -0.1850501298904419, + 0.742441713809967, + 0.4285193383693695, + -0.710474967956543, + -0.7941843867301941, + -0.4207003712654114, + 0.6676210165023804, + -0.6598520874977112, + -0.46604686975479126, + 0.29844197630882263 + ], + "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..2de52d951e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/exp.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "exp float32 1D constant tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + }, + { + "name": "exp float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + }, + { + "name": "exp float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + }, + { + "name": "exp float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + }, + { + "name": "exp float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + }, + { + "name": "exp float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.342143655338516, + -3.3109650690636583, + -3.696757542725746, + -5.105378072825206, + 5.471040383543361, + -0.06790750193598072, + 2.7373435551676373, + -3.547075850060808, + 5.3392248393586215, + -1.2636781380561768, + -0.9162953518691133, + -9.088432637604779, + -4.016050813135332, + 4.670352907446356, + 7.326991954708756, + 8.294342869341662, + -7.3454139558670795, + -0.9275799995316945, + -1.7085379363808997, + -9.737379277450184, + -1.9747875652397973, + 8.203150154065185, + -7.267597492286808, + -3.5890684093944714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 1.4079625606536865, + 0.03648095205426216, + 0.024803820997476578, + 0.006064045242965221, + 237.70733642578125, + 0.9343469142913818, + 15.44589900970459, + 0.02880876138806343, + 208.35113525390625, + 0.2826126217842102, + 0.39999815821647644, + 0.00011296502634650096, + 0.018024004995822906, + 106.73540496826172, + 1520.8004150390625, + 4001.173583984375, + 0.0006455459515564144, + 0.3955096900463104, + 0.18113042414188385, + 0.0000590350573475007, + 0.1387907862663269, + 3652.4365234375, + 0.0006977862794883549, + 0.02762405201792717 + ], + "type": "float32" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/expand.json b/testing/web-platform/tests/webnn/resources/test_data/expand.json new file mode 100644 index 0000000000..00bf4a37b4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/expand.json @@ -0,0 +1,994 @@ +{ + "tests": [ + { + "name": "expand float32 0D scalar to 1D", + "inputs": { + "input": { + "shape": [], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [24], + "expected": { + "name": "output", + "shape": [24], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 0D scalar to 2D", + "inputs": { + "input": { + "shape": [], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 0D scalar to 3D", + "inputs": { + "input": { + "shape": [], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 3, 4], + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 0D scalar to 4D", + "inputs": { + "input": { + "shape": [], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 2, 3], + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 0D scalar to 5D", + "inputs": { + "input": { + "shape": [], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 3, 1, 2], + "expected": { + "name": "output", + "shape": [2, 2, 3, 1, 2], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D constant tensor to 1D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32", + "constant": true + } + }, + "newShape": [24], + "expected": { + "name": "output", + "shape": [24], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D tensor to 1D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [24], + "expected": { + "name": "output", + "shape": [24], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D tensor to 2D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D tensor to 3D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 3, 4], + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D tensor to 4D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 2, 3], + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 1D tensor to 5D", + "inputs": { + "input": { + "shape": [1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 3, 1, 2], + "expected": { + "name": "output", + "shape": [2, 2, 3, 1, 2], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 2D (1st dimension)", + "inputs": { + "input": { + "shape": [1, 6], + "data": [ + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375 + ], + "type": "float32" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 2D (2nd dimension)", + "inputs": { + "input": { + "shape": [4, 1], + "data": [ + 4.965915679931641, + 66.14382934570312, + 75.28175354003906, + 49.998130798339844 + ], + "type": "float32" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 2D (all dimensions)", + "inputs": { + "input": { + "shape": [1, 1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 3D", + "inputs": { + "input": { + "shape": [4, 1], + "data": [ + 4.965915679931641, + 66.14382934570312, + 75.28175354003906, + 49.998130798339844 + ], + "type": "float32" + } + }, + "newShape": [2, 4, 3], + "expected": { + "name": "output", + "shape": [2, 4, 3], + "data": [ + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844, + 4.965915679931641, + 4.965915679931641, + 4.965915679931641, + 66.14382934570312, + 66.14382934570312, + 66.14382934570312, + 75.28175354003906, + 75.28175354003906, + 75.28175354003906, + 49.998130798339844, + 49.998130798339844, + 49.998130798339844 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 4D", + "inputs": { + "input": { + "shape": [1, 6], + "data": [ + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375 + ], + "type": "float32" + } + }, + "newShape": [2, 1, 2, 6], + "expected": { + "name": "output", + "shape": [2, 1, 2, 6], + "data": [ + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375, + 10.898762702941895, + -29.391416549682617, + -73.74250793457031, + 22.456905364990234, + -97.5792465209961, + -76.95013427734375 + ], + "type": "float32" + } + }, + { + "name": "expand float32 2D tensor to 5D", + "inputs": { + "input": { + "shape": [1, 1], + "data": [ + -6.461850643157959 + ], + "type": "float32" + } + }, + "newShape": [2, 1, 3, 2, 2], + "expected": { + "name": "output", + "shape": [2, 1, 3, 2, 2], + "data": [ + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959, + -6.461850643157959 + ], + "type": "float32" + } + }, + { + "name": "expand float32 3D tensor to 3D", + "inputs": { + "input": { + "shape": [1, 2, 1], + "data": [ + 21.694129943847656, + -72.82571411132812 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 6], + "expected": { + "name": "output", + "shape": [2, 2, 6], + "data": [ + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812 + ], + "type": "float32" + } + }, + { + "name": "expand float32 3D tensor to 4D", + "inputs": { + "input": { + "shape": [1, 2, 1], + "data": [ + 21.694129943847656, + -72.82571411132812 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 2, 3], + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812 + ], + "type": "float32" + } + }, + { + "name": "expand float32 3D tensor to 5D", + "inputs": { + "input": { + "shape": [1, 2, 1], + "data": [ + 21.694129943847656, + -72.82571411132812 + ], + "type": "float32" + } + }, + "newShape": [2, 1, 2, 2, 3], + "expected": { + "name": "output", + "shape": [2, 1, 2, 2, 3], + "data": [ + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812, + 21.694129943847656, + 21.694129943847656, + 21.694129943847656, + -72.82571411132812, + -72.82571411132812, + -72.82571411132812 + ], + "type": "float32" + } + }, + { + "name": "expand float32 4D tensor to 4D", + "inputs": { + "input": { + "shape": [2, 1, 1, 1], + "data": [ + 12.799123764038086, + -26.550199508666992 + ], + "type": "float32" + } + }, + "newShape": [2, 3, 2, 2], + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992 + ], + "type": "float32" + } + }, + { + "name": "expand float32 4D tensor to 5D", + "inputs": { + "input": { + "shape": [2, 1, 1, 1], + "data": [ + 12.799123764038086, + -26.550199508666992 + ], + "type": "float32" + } + }, + "newShape": [2, 2, 3, 1, 2], + "expected": { + "name": "output", + "shape": [2, 2, 3, 1, 2], + "data": [ + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + 12.799123764038086, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992, + -26.550199508666992 + ], + "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..3b5dba1576 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/floor.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "floor float32 1D constant 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", + "constant": true + } + }, + "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 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/gather.json b/testing/web-platform/tests/webnn/resources/test_data/gather.json new file mode 100644 index 0000000000..a01654637f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/gather.json @@ -0,0 +1,1268 @@ +{ + "tests": [ + { + "name": "gather float32 1D tensor and uint32 0D scalar indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [], + "data": [ + 4 + ], + "type": "uint32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 89.0337142944336 + ], + "type": "float32" + } + }, + { + "name": "gather float32 1D tensor and int64 0D scalar indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [], + "data": [ + 0 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + -66.05901336669922 + ], + "type": "float32" + } + }, + { + "name": "gather float32 1D tensor and int64 1D indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [8], + "data": [ + 16, + 20, + 6, + 11, + 17, + 19, + 13, + 17 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [8], + "data": [ + 10.829925537109375, + 0.9129875898361206, + 43.84803771972656, + -50.42131042480469, + -19.693084716796875, + 43.11057662963867, + 55.620765686035156, + -19.693084716796875 + ], + "type": "float32" + } + }, + { + "name": "gather float32 1D tensor and int64 2D indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 14, + 9, + 21, + 17 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 44.92119598388672, + 41.94132614135742, + -7.699817180633545, + -19.693084716796875 + ], + "type": "float32" + } + }, + { + "name": "gather float32 1D tensor and int64 3D indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 3, 3], + "data": [ + 17, + 19, + 14, + 16, + 13, + 0, + 5, + 15, + 18, + 18, + 6, + 20, + 7, + 22, + 5, + 1, + 4, + 19 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 3], + "data": [ + -19.693084716796875, + 43.11057662963867, + 44.92119598388672, + 10.829925537109375, + 55.620765686035156, + -66.05901336669922, + -45.89653396606445, + 56.828636169433594, + -37.696800231933594, + -37.696800231933594, + 43.84803771972656, + 0.9129875898361206, + 48.81806945800781, + 25.76774024963379, + -45.89653396606445, + -68.9197006225586, + 89.0337142944336, + 43.11057662963867 + ], + "type": "float32" + } + }, + { + "name": "gather float32 1D tensor and int64 4D indices default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [1, 2, 2, 3], + "data": [ + 18, + 18, + 22, + 11, + 8, + 15, + 12, + 11, + 7, + 13, + 7, + 7 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 3], + "data": [ + -37.696800231933594, + -37.696800231933594, + 25.76774024963379, + -50.42131042480469, + 51.79948425292969, + 56.828636169433594, + 90.2870101928711, + -50.42131042480469, + 48.81806945800781, + 55.620765686035156, + 48.81806945800781, + 48.81806945800781 + ], + "type": "float32" + } + }, + { + "name": "gather float32 2D tensor and 0D scalar indices default options", + "inputs": { + "input": { + "shape": [12, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [], + "data": [ + 11 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2], + "data": [ + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + } + }, + { + "name": "gather float32 2D tensor and 1D indices default options", + "inputs": { + "input": { + "shape": [12, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [8], + "data": [ + 1, + 10, + 9, + 0, + 3, + 5, + 3, + 8 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [8, 2], + "data": [ + -77.02045440673828, + -26.158037185668945, + 0.9129875898361206, + -7.699817180633545, + -37.696800231933594, + 43.11057662963867, + -66.05901336669922, + -68.9197006225586, + 43.84803771972656, + 48.81806945800781, + -1.1303654909133911, + -50.42131042480469, + 43.84803771972656, + 48.81806945800781, + 10.829925537109375, + -19.693084716796875 + ], + "type": "float32" + } + }, + { + "name": "gather float32 2D tensor and 2D indices default options", + "inputs": { + "input": { + "shape": [12, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 4, + 8, + 9, + 10 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2], + "data": [ + 51.79948425292969, + 41.94132614135742, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545 + ], + "type": "float32" + } + }, + { + "name": "gather float32 2D tensor and 3D indices default options", + "inputs": { + "input": { + "shape": [12, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 3, 3], + "data": [ + 8, + 2, + 2, + 3, + 4, + 1, + 2, + 2, + 7, + 11, + 4, + 11, + 6, + 6, + 7, + 3, + 11, + 10 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 3, 2], + "data": [ + 10.829925537109375, + -19.693084716796875, + 89.0337142944336, + -45.89653396606445, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 89.0337142944336, + -45.89653396606445, + 44.92119598388672, + 56.828636169433594, + 25.76774024963379, + 73.60064697265625, + 51.79948425292969, + 41.94132614135742, + 25.76774024963379, + 73.60064697265625, + 90.2870101928711, + 55.620765686035156, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 43.84803771972656, + 48.81806945800781, + 25.76774024963379, + 73.60064697265625, + 0.9129875898361206, + -7.699817180633545 + ], + "type": "float32" + } + }, + { + "name": "gather float32 2D tensor and 4D indices default options", + "inputs": { + "input": { + "shape": [12, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [1, 2, 2, 3], + "data": [ + 6, + 9, + 7, + 3, + 4, + 7, + 4, + 3, + 7, + 7, + 6, + 0 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 3, 2], + "data": [ + 90.2870101928711, + 55.620765686035156, + -37.696800231933594, + 43.11057662963867, + 44.92119598388672, + 56.828636169433594, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + 44.92119598388672, + 56.828636169433594, + 51.79948425292969, + 41.94132614135742, + 43.84803771972656, + 48.81806945800781, + 44.92119598388672, + 56.828636169433594, + 44.92119598388672, + 56.828636169433594, + 90.2870101928711, + 55.620765686035156, + -66.05901336669922, + -68.9197006225586 + ], + "type": "float32" + } + }, + { + "name": "gather float32 3D tensor and 2D indices default options", + "inputs": { + "input": { + "shape": [3, 4, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 2, + 1, + 1, + 1 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 4, 2], + "data": [ + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594 + ], + "type": "float32" + } + }, + { + "name": "gather float32 4D tensor and 2D indices default options", + "inputs": { + "input": { + "shape": [8, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 0, + 0, + 7, + 4 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672 + ], + "type": "float32" + } + }, + { + "name": "gather float32 5D tensor and 1D indices default options", + "inputs": { + "input": { + "shape": [4, 2, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [3], + "data": [ + 3, + 2, + 2 + ], + "type": "int64" + } + }, + "expected": { + "name": "output", + "shape": [3, 2, 1, 1, 3], + "data": [ + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875 + ], + "type": "float32" + } + }, + { + "name": "gather float32 3D tensor and 1D indices options.axis=1", + "inputs": { + "input": { + "shape": [3, 4, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [3], + "data": [ + 1, + 1, + 2 + ], + "type": "int64" + } + }, + "options": { + "axis": 1 + }, + "expected": { + "name": "output", + "shape": [3, 3, 2], + "data": [ + -77.02045440673828, + -26.158037185668945, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + -1.1303654909133911, + -50.42131042480469, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + -37.696800231933594, + 43.11057662963867, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545 + ], + "type": "float32" + } + }, + { + "name": "gather float32 3D tensor and 2D indices options.axis=2", + "inputs": { + "input": { + "shape": [3, 4, 2], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 0, + 0, + 0, + 1 + ], + "type": "int64" + } + }, + "options": { + "axis": 2 + }, + "expected": { + "name": "output", + "shape": [3, 4, 2, 2], + "data": [ + -66.05901336669922, + -66.05901336669922, + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -77.02045440673828, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + 89.0337142944336, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 43.84803771972656, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 51.79948425292969, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -1.1303654909133911, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 90.2870101928711, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 44.92119598388672, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + 10.829925537109375, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + -37.696800231933594, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + 0.9129875898361206, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 25.76774024963379, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + } + }, + { + "name": "gather float32 4D tensor and 2D indices explict options.axis=0", + "inputs": { + "input": { + "shape": [8, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [2, 2], + "data": [ + 0, + 0, + 7, + 4 + ], + "type": "int64" + } + }, + "options": { + "axis": 0 + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672 + ], + "type": "float32" + } + }, + { + "name": "gather float32 5D tensor and 0D scalar indices options.axis=4", + "inputs": { + "input": { + "shape": [4, 2, 1, 1, 3], + "data": [ + -66.05901336669922, + -68.9197006225586, + -77.02045440673828, + -26.158037185668945, + 89.0337142944336, + -45.89653396606445, + 43.84803771972656, + 48.81806945800781, + 51.79948425292969, + 41.94132614135742, + -1.1303654909133911, + -50.42131042480469, + 90.2870101928711, + 55.620765686035156, + 44.92119598388672, + 56.828636169433594, + 10.829925537109375, + -19.693084716796875, + -37.696800231933594, + 43.11057662963867, + 0.9129875898361206, + -7.699817180633545, + 25.76774024963379, + 73.60064697265625 + ], + "type": "float32" + }, + "indices": { + "shape": [], + "data": [ + 1 + ], + "type": "int64" + } + }, + "options": { + "axis": 4 + }, + "expected": { + "name": "output", + "shape": [4, 2, 1, 1], + "data": [ + -68.9197006225586, + 89.0337142944336, + 48.81806945800781, + -1.1303654909133911, + 55.620765686035156, + 10.829925537109375, + 43.11057662963867, + 25.76774024963379 + ], + "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..23a18b316c --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/gemm.json @@ -0,0 +1,1953 @@ +{ + "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 constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "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 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/greater.json b/testing/web-platform/tests/webnn/resources/test_data/greater.json new file mode 100644 index 0000000000..d7dc34d18b --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/greater.json @@ -0,0 +1,982 @@ +{ + "tests": [ + { + "name": "greater float32 0D scalar", + "inputs": { + "a": { + "shape": [], + "data": [ + 3.6851014232119716 + ], + "type": "float32" + }, + "b": { + "shape": [], + "data": [ + 1.7231997782518338 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 1 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 1D constant tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [24], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -6.155234276085855, + -4.023341341511664, + 5.9525983178014386, + 2.3066237309537883, + -2.7692292888690817, + -0.9711201246625745, + 1.2222066588909755, + 4.590261643319389, + 9.101232896619365, + -4.997007709812857, + -4.807293508200368, + 8.919360491720344, + 0.900502762346548, + -2.8414556193065543, + -2.8280412040974845, + 8.479845345966147, + -7.840679465875833, + 9.213960197279938, + 4.982364937519449, + -2.5073192467116145, + -4.518013838492472, + 8.351094603114355, + -6.161073167579363, + 0.7364829132932815 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2, 3], + "data": [ + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 broadcast 0D to 4D", + "inputs": { + "a": { + "shape": [], + "data": [ + 6.22164122692616 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 6.22164122692616 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -2.684664470849163, + 6.170023353490912, + 9.487744366422781, + -2.555641152388084, + -2.0436435571200873, + 8.533930402669746 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -7.099076082908593, + -7.781408238233589, + 8.782817806924719, + -8.948624418290514 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greater float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 6.22164122692616 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -5.394711458674926, + -7.189248660357093, + -3.108176577372168, + 4.977657240654292, + 5.111654167277017, + -1.538657969029952, + 1.4143663572463936, + -0.9362112515011844, + -6.029961511382025, + -3.0134198095493225, + 0.17085531331013115, + 7.395327146335315, + 7.178691694492247, + -4.826237489933036, + -2.0204401018636275, + -3.267887959306748, + 8.944384478538513, + -5.9321008596864555, + 0.7069857360876597, + 2.7764204012258844, + 0.9788337909419198, + -6.254901877789392, + 4.40903450389083, + -6.775286805113776 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1 + ], + "type": "uint8" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/greater_or_equal.json b/testing/web-platform/tests/webnn/resources/test_data/greater_or_equal.json new file mode 100644 index 0000000000..e47ac4350a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/greater_or_equal.json @@ -0,0 +1,970 @@ +{ + "tests": [ + { + "name": "greaterOrEqual float32 0D scalar", + "inputs": { + "a": { + "shape": [], + "data": [ + 0.2829853513361833 + ], + "type": "float32" + }, + "b": { + "shape": [], + "data": [ + 6.156983509735351 + ], + "type": "float32" + } + }, + "expected": { + "shape": [], + "data": [ + 0 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 1D constant tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [24], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [24], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32" + } + }, + "expected": { + "shape": [24], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32" + } + }, + "expected": { + "shape": [4, 6], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 3, 4], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -7.028095113692983, + 1.9109992244501228, + 3.576529209692282, + 1.7167964605289043, + 2.846137548919838, + -2.311762981138341, + -6.086130252861408, + -3.437926736129744, + -3.4764428213302656, + -2.194656398262036, + 2.9962267558939892, + -5.540947945499273, + 5.098470133217425, + 6.775498827056623, + 2.4505413384295913, + 5.210598812779001, + -9.710094050019439, + -2.413028179599279, + 8.678308853275162, + -9.449530756013411, + 0.7702168987269076, + -1.518607415508292, + -9.15394321549195, + -4.9917360557925194 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 broadcast 0D to 4D", + "inputs": { + "a": { + "shape": [], + "data": [ + -1.0187572964482339 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + -1.0187572964482339 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -4.19451362795888, + 3.8917840404002177, + -3.5139974150349484, + 6.279316420756992, + 0.0017881708061917578, + -0.7928582491851124 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -3.282304702993888, + -1.397563682654157, + 0.4905360718662557, + -6.882648917469618 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1 + ], + "type": "uint8" + } + }, + { + "name": "greaterOrEqual float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + -1.0187572964482339 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.049108184315305, + -5.522611295148119, + -2.097508268712267, + -7.455326346855671, + -5.4503762765457475, + 9.802918209039795, + -3.6045179646016123, + 4.088084930154503, + -5.068354954162224, + 1.5821936652025705, + 5.675583814922739, + -4.34159498166756, + 1.6946222397391875, + 2.926734617639429, + -7.000074175864097, + -2.5270822950013105, + 1.4437268276959525, + 7.862768559473771, + 5.782288879751384, + 1.8712013338616238, + -0.5233999645803635, + 0.43433289218891247, + 8.938365119196128, + 1.65683957584843 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 0, + 1, + 0, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "type": "uint8" + } + } + ] +} \ 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..5d8c0c5daf --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/hard_sigmoid.json @@ -0,0 +1,957 @@ +{ // hardSigmoid: Calculate the non-smooth function used in place of a sigmoid function on the input tensor. + "tests": [ + { + "name": "hardSigmoid float32 positive 1D constant 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", + "constant": true + } + }, + "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 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..e43f62ede0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/hard_swish.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "hardSwish float32 1D constant 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", + "constant": true + } + }, + "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 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/identity.json b/testing/web-platform/tests/webnn/resources/test_data/identity.json new file mode 100644 index 0000000000..6024e8786f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/identity.json @@ -0,0 +1,422 @@ +{ + "tests": [ + { + "name": "identity float32 0D scalar", + "inputs": { + "input": { + "shape": [], + "data": [ + -4.273642352495437 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + -4.273642539978027 + ], + "type": "float32" + } + }, + { + "name": "identity float32 1D constant tensor", + "inputs": { + "input": { + "shape":[24], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32", + "constant": true + } + }, + { + "name": "identity float32 1D tensor", + "inputs": { + "input": { + "shape":[24], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32" + } + }, + { + "name": "identity float32 2D tensor", + "inputs": { + "input": { + "shape":[4, 6], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32" + } + }, + { + "name": "identity float32 3D tensor", + "inputs": { + "input": { + "shape":[2, 3, 4], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32" + } + }, + { + "name": "identity float32 4D tensor", + "inputs": { + "input": { + "shape":[2, 2, 2, 3], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32" + } + }, + { + "name": "identity float32 5D tensor", + "inputs": { + "input": { + "shape":[2, 1, 4, 1, 3], + "data": [ + 0.3775514170243319, + -0.8890897684684553, + 9.965806154214683, + 7.964576323402355, + -4.207889285235442, + -3.748703004469509, + -2.5114005246358584, + 5.777673182705456, + -4.472823584733945, + -8.405767426137253, + -3.857972358579822, + 6.0361876313443865, + 9.076417609486516, + 7.101912233390028, + 1.4166420410053604, + -5.644308337756456, + -2.598648114422626, + -7.264847061642685, + -9.782458548766716, + 5.4966995825042275, + -9.967339588615012, + -6.901016518448189, + -2.850190435789366, + 3.279616439989832 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.377551406621933, + -0.8890897631645203, + 9.965806007385254, + 7.964576244354248, + -4.207889080047607, + -3.7487030029296875, + -2.5114004611968994, + 5.777673244476318, + -4.472823619842529, + -8.405767440795898, + -3.8579723834991455, + 6.036187648773193, + 9.076417922973633, + 7.101912021636963, + 1.4166420698165894, + -5.644308567047119, + -2.5986480712890625, + -7.264847278594971, + -9.782458305358887, + 5.496699810028076, + -9.967339515686035, + -6.901016712188721, + -2.8501904010772705, + 3.279616355895996 + ], + "type": "float32" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/instance_normalization.json b/testing/web-platform/tests/webnn/resources/test_data/instance_normalization.json new file mode 100644 index 0000000000..a9fd493c99 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/instance_normalization.json @@ -0,0 +1,519 @@ +{ + "tests": [ + { + "name": "instanceNormalization float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -97.949951171875, + 29.44037628173828, + -73.92131042480469, + -38.11185836791992, + 41.33772659301758, + -59.77853012084961, + -74.66901397705078, + -68.16508483886719, + 35.82481384277344, + -6.948329448699951, + 54.42462158203125, + 47.53074645996094, + 66.93562316894531, + 76.74034881591797, + 5.6758809089660645, + 25.68659210205078, + 37.37651062011719, + 56.252689361572266, + -16.574905395507812, + 42.949893951416016, + 73.8739242553711, + -99.00035095214844, + -33.11322784423828, + -17.380685806274414 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + -1.0995290279388428, + 1.5525832176208496, + -0.5992818474769592, + 0.14622758328914642, + 1.72129487991333, + -0.41020718216896057, + -0.7240943908691406, + -0.586993396282196, + 0.13073226809501648, + -1.6633318662643433, + 0.9108771681785583, + 0.6217224597930908, + 0.7947131395339966, + 1.1309205293655396, + -1.3059037923812866, + -0.6197298169136047, + 0.2657700479030609, + 0.9459608793258667, + -1.6783342361450195, + 0.46660327911376953, + 1.5037200450897217, + -1.2981476783752441, + -0.2302791178226471, + 0.024706769734621048 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor options.scale", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -97.949951171875, + 29.44037628173828, + -73.92131042480469, + -38.11185836791992, + 41.33772659301758, + -59.77853012084961, + -74.66901397705078, + -68.16508483886719, + 35.82481384277344, + -6.948329448699951, + 54.42462158203125, + 47.53074645996094, + 66.93562316894531, + 76.74034881591797, + 5.6758809089660645, + 25.68659210205078, + 37.37651062011719, + 56.252689361572266, + -16.574905395507812, + 42.949893951416016, + 73.8739242553711, + -99.00035095214844, + -33.11322784423828, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "scale": { + "shape": [3], + "data": [ + -94.42772674560547, + 66.69620513916016, + -98.56572723388672 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + 103.8260269165039, + -146.60690307617188, + 56.58882141113281, + -13.807937622070312, + 114.80384063720703, + -27.359262466430664, + -48.29434585571289, + -39.150230407714844, + -12.885721206665039, + 163.94752502441406, + -89.78126525878906, + -61.2805290222168, + -75.04296112060547, + -106.79025268554688, + 123.31352996826172, + 58.51968002319336, + 17.725852966308594, + 63.09199905395508, + -111.93852233886719, + 31.120668411254883, + -148.2152557373047, + 127.95286560058594, + 22.697628021240234, + -2.4352407455444336 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor options.bias", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -97.949951171875, + 29.44037628173828, + -73.92131042480469, + -38.11185836791992, + 41.33772659301758, + -59.77853012084961, + -74.66901397705078, + -68.16508483886719, + 35.82481384277344, + -6.948329448699951, + 54.42462158203125, + 47.53074645996094, + 66.93562316894531, + 76.74034881591797, + 5.6758809089660645, + 25.68659210205078, + 37.37651062011719, + 56.252689361572266, + -16.574905395507812, + 42.949893951416016, + 73.8739242553711, + -99.00035095214844, + -33.11322784423828, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "bias": { + "shape": [3], + "data": [ + -33.048641204833984, + 4.511423587799072, + -37.93617248535156 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + -34.148170471191406, + -31.496057510375977, + -33.64792251586914, + -32.90241241455078, + 6.232718467712402, + 4.1012163162231445, + 3.7873291969299316, + 3.9244301319122314, + -37.80543899536133, + -39.59950256347656, + -37.02529525756836, + -37.314449310302734, + -32.253929138183594, + -31.917720794677734, + -34.35454559326172, + -33.66836929321289, + 4.777193546295166, + 5.4573845863342285, + 2.8330893516540527, + 4.978026866912842, + -36.43245315551758, + -39.23432159423828, + -38.16645050048828, + -37.91146469116211 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor options.epsilon", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -97.949951171875, + 29.44037628173828, + -73.92131042480469, + -38.11185836791992, + 41.33772659301758, + -59.77853012084961, + -74.66901397705078, + -68.16508483886719, + 35.82481384277344, + -6.948329448699951, + 54.42462158203125, + 47.53074645996094, + 66.93562316894531, + 76.74034881591797, + 5.6758809089660645, + 25.68659210205078, + 37.37651062011719, + 56.252689361572266, + -16.574905395507812, + 42.949893951416016, + 73.8739242553711, + -99.00035095214844, + -33.11322784423828, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "epsilon": 0.000001 + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + -1.0995290279388428, + 1.5525832176208496, + -0.5992818474769592, + 0.14622758328914642, + 1.72129487991333, + -0.41020718216896057, + -0.7240943908691406, + -0.586993396282196, + 0.13073226809501648, + -1.6633318662643433, + 0.9108771681785583, + 0.6217224597930908, + 0.7947131991386414, + 1.1309205293655396, + -1.3059037923812866, + -0.6197298765182495, + 0.2657700479030609, + 0.9459608793258667, + -1.6783342361450195, + 0.46660327911376953, + 1.5037200450897217, + -1.2981476783752441, + -0.2302791178226471, + 0.024706769734621048 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor explict options.layout='nchw'", + "inputs": { + "input": { + "shape": [2, 3, 2, 2], + "data": [ + -97.949951171875, + 29.44037628173828, + -73.92131042480469, + -38.11185836791992, + 41.33772659301758, + -59.77853012084961, + -74.66901397705078, + -68.16508483886719, + 35.82481384277344, + -6.948329448699951, + 54.42462158203125, + 47.53074645996094, + 66.93562316894531, + 76.74034881591797, + 5.6758809089660645, + 25.68659210205078, + 37.37651062011719, + 56.252689361572266, + -16.574905395507812, + 42.949893951416016, + 73.8739242553711, + -99.00035095214844, + -33.11322784423828, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "layout": "nchw" + }, + "expected": { + "name": "output", + "shape": [2, 3, 2, 2], + "data": [ + -1.0995290279388428, + 1.5525832176208496, + -0.5992818474769592, + 0.14622758328914642, + 1.72129487991333, + -0.41020718216896057, + -0.7240943908691406, + -0.586993396282196, + 0.13073226809501648, + -1.6633318662643433, + 0.9108771681785583, + 0.6217224597930908, + 0.7947131395339966, + 1.1309205293655396, + -1.3059037923812866, + -0.6197298169136047, + 0.2657700479030609, + 0.9459608793258667, + -1.6783342361450195, + 0.46660327911376953, + 1.5037200450897217, + -1.2981476783752441, + -0.2302791178226471, + 0.024706769734621048 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor options.layout='nhwc'", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -97.949951171875, + 41.33772659301758, + 35.82481384277344, + 29.44037628173828, + -59.77853012084961, + -6.948329448699951, + -73.92131042480469, + -74.66901397705078, + 54.42462158203125, + -38.11185836791992, + -68.16508483886719, + 47.53074645996094, + 66.93562316894531, + 37.37651062011719, + 73.8739242553711, + 76.74034881591797, + 56.252689361572266, + -99.00035095214844, + 5.6758809089660645, + -16.574905395507812, + -33.11322784423828, + 25.68659210205078, + 42.949893951416016, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -1.0995290279388428, + 1.72129487991333, + 0.13073226809501648, + 1.5525832176208496, + -0.41020718216896057, + -1.6633318662643433, + -0.5992818474769592, + -0.7240943908691406, + 0.9108771681785583, + 0.14622758328914642, + -0.586993396282196, + 0.6217224597930908, + 0.7947131395339966, + 0.2657700479030609, + 1.5037200450897217, + 1.1309205293655396, + 0.9459608793258667, + -1.2981476783752441, + -1.3059037923812866, + -1.6783342361450195, + -0.2302791178226471, + -0.6197298169136047, + 0.46660327911376953, + 0.024706769734621048 + ], + "type": "float32" + } + }, + { + "name": "instanceNormalization float32 4D tensor all options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + -97.949951171875, + 41.33772659301758, + 35.82481384277344, + 29.44037628173828, + -59.77853012084961, + -6.948329448699951, + -73.92131042480469, + -74.66901397705078, + 54.42462158203125, + -38.11185836791992, + -68.16508483886719, + 47.53074645996094, + 66.93562316894531, + 37.37651062011719, + 73.8739242553711, + 76.74034881591797, + 56.252689361572266, + -99.00035095214844, + 5.6758809089660645, + -16.574905395507812, + -33.11322784423828, + 25.68659210205078, + 42.949893951416016, + -17.380685806274414 + ], + "type": "float32" + } + }, + "options": { + "scale": { + "shape": [3], + "data": [ + -94.42772674560547, + 66.69620513916016, + -98.56572723388672 + ], + "type": "float32" + }, + "bias": { + "shape": [3], + "data": [ + -33.048641204833984, + 4.511423587799072, + -37.93617248535156 + ], + "type": "float32" + }, + "epsilon": 0.000001, + "layout": "nhwc" + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.77738189697266, + 119.31526184082031, + -50.821895599365234, + -179.65554809570312, + -22.847837448120117, + 126.01134490966797, + 23.540178298950195, + -43.782920837402344, + -127.71744537353516, + -46.8565788269043, + -34.6388053894043, + -99.2166976928711, + -108.09159851074219, + 22.237276077270508, + -186.15142822265625, + -139.83889770507812, + 67.60342407226562, + 90.01669311523438, + 90.26488494873047, + -107.4271011352539, + -15.238543510437012, + 25.471038818359375, + 35.6320915222168, + -40.37141418457031 + ], + "type": "float32" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/layer_normalization.json b/testing/web-platform/tests/webnn/resources/test_data/layer_normalization.json new file mode 100644 index 0000000000..6005776de5 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/layer_normalization.json @@ -0,0 +1,842 @@ +{ + "tests": [ + { + "name": "layerNormalization float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -1.5257738828659058, + 0.997844934463501, + 0.017018765211105347, + -0.9768186211585999, + 1.2984753847122192, + 0.18925349414348602, + 1.0812907218933105, + -0.915019690990448, + 0.4270379841327667, + -1.6873507499694824, + 0.9745554327964783, + 0.11948632448911667, + -1.5086692571640015, + 0.6123882532119751, + 0.5316619873046875, + 1.2018805742263794, + -1.215880036354065, + 0.378618448972702, + -1.795186161994934, + -0.6376377940177917, + 1.1961140632629395, + 0.034106940031051636, + 0.9297415614128113, + 0.2728613615036011 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -1.4057259559631348, + 0.5396455526351929, + -0.21643976867198944, + -0.9825550317764282, + 0.7713912725448608, + -0.08366990834474564, + 1.46259605884552, + -0.8138729333877563, + 0.7165266871452332, + -1.6945916414260864, + 1.3408818244934082, + 0.3658137917518616, + -1.5234858989715576, + 0.5162702202796936, + 0.43863821029663086, + 1.0831668376922607, + -1.2419193983078003, + 0.29146093130111694, + -1.7796510457992554, + -0.5852779150009155, + 1.3068104982376099, + 0.10783683508634567, + 1.0319640636444092, + 0.35418668389320374 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -1.4057259559631348, + 0.5396455526351929, + -0.21643976867198944, + -0.9825550317764282, + 0.7713912725448608, + -0.08366990834474564, + 1.46259605884552, + -0.8138729333877563, + 0.7165266871452332, + -1.6945916414260864, + 1.3408818244934082, + 0.3658137917518616, + -1.5234858989715576, + 0.5162702202796936, + 0.43863821029663086, + 1.0831668376922607, + -1.2419193983078003, + 0.29146093130111694, + -1.7796510457992554, + -0.5852779150009155, + 1.3068104982376099, + 0.10783683508634567, + 1.0319640636444092, + 0.35418668389320374 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 2, 2, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 2, 2, 3], + "data": [ + -1.4057259559631348, + 0.5396455526351929, + -0.21643976867198944, + -0.9825550317764282, + 0.7713912725448608, + -0.08366990834474564, + 1.46259605884552, + -0.8138729333877563, + 0.7165266871452332, + -1.6945916414260864, + 1.3408818244934082, + 0.3658137917518616, + -1.5234858989715576, + 0.5162702202796936, + 0.43863821029663086, + 1.0831668376922607, + -1.2419193983078003, + 0.29146093130111694, + -1.7796510457992554, + -0.5852779150009155, + 1.3068104982376099, + 0.10783683508634567, + 1.0319640636444092, + 0.35418668389320374 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.scale", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "scale": { + "shape": [1, 4, 3], + "data": [ + -3.822842326186211, + -5.4524582226774365, + 0.6776165732478745, + -4.027037630534966, + -3.7771617295664717, + -9.327335252346955, + 7.181691199879712, + 1.5054303426700422, + 3.1208942770408132, + 0.5214731591212676, + 2.6719749293214345, + -3.5713709254192016 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + 5.373868465423584, + -2.942394971847534, + -0.14666318893432617, + 3.9567861557006836, + -2.9136698246002197, + 0.780417263507843, + 10.503913879394531, + -1.225229024887085, + 2.236203908920288, + -0.8836840987205505, + 3.5828025341033936, + -1.3064566850662231, + 5.824046611785889, + -2.814941883087158, + 0.29722854495048523, + -4.3619537353515625, + 4.6909308433532715, + -2.7185537815093994, + -12.780903816223145, + -0.8810951709747314, + 4.0784173011779785, + 0.05623401328921318, + 2.7573819160461426, + -1.2649319171905518 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.bias", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "bias": { + "shape": [1, 4, 3], + "data": [ + 7.86298294434458, + -3.660304771854861, + -6.955524501645973, + -6.397322772511171, + 3.2689586393414984, + -2.7498081789293094, + -4.080942283863029, + -7.137991900788561, + 8.465653688103547, + 2.762545157541174, + 0.8230442324150911, + -3.8275613744392922 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + 6.45725679397583, + -3.120659112930298, + -7.171964168548584, + -7.37987756729126, + 4.040349960327148, + -2.8334779739379883, + -2.6183459758758545, + -7.951864719390869, + 9.182180404663086, + 1.0679534673690796, + 2.163926124572754, + -3.461747646331787, + 6.339496612548828, + -3.1440346240997314, + -6.516886234283447, + -5.314155578613281, + 2.027039051055908, + -2.4583470821380615, + -5.860593318939209, + -7.723269939422607, + 9.77246379852295, + 2.8703818321228027, + 1.8550082445144653, + -3.473374605178833 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.axes=[2]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -0.6012066006660461, + 0.10132180899381638, + -1.112992763519287, + -0.26228588819503784, + 0.3943416476249695, + -0.7543209195137024, + 1.6960537433624268, + -1.6100702285766602, + 1.4073745012283325, + -0.8325613141059875, + 1.114406704902649, + 0.45993921160697937, + -0.8445013165473938, + 0.6554933190345764, + -0.3856155574321747, + 1.3668763637542725, + -1.3111618757247925, + -0.7422532439231873, + -1.0618212223052979, + -0.5766634941101074, + 1.7181260585784912, + 0.539446234703064, + 1.2323321104049683, + -0.5902572274208069 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.epsilon", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "epsilon": 1e-4 + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -1.4057258367538452, + 0.5396455526351929, + -0.21643976867198944, + -0.9825550317764282, + 0.7713912725448608, + -0.08366990089416504, + 1.46259605884552, + -0.8138729333877563, + 0.7165266871452332, + -1.6945916414260864, + 1.3408817052841187, + 0.3658137619495392, + -1.5234858989715576, + 0.5162702202796936, + 0.43863821029663086, + 1.0831668376922607, + -1.2419193983078003, + 0.29146093130111694, + -1.7796509265899658, + -0.5852779150009155, + 1.3068104982376099, + 0.10783682763576508, + 1.0319639444351196, + 0.35418668389320374 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.scale and options.axes=[0, 2]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "scale": { + "shape": [2, 4], + "data": [ + 8.726573383699723, + -5.388210753831433, + -6.811323199504957, + 4.707905497256553, + -4.705779931167426, + -5.143046959493542, + -1.1115549861715444, + 5.250569701742819 + ], + "type": "float32" + }, + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -3.3744184970855713, + 5.22746467590332, + -7.580371856689453, + 0.3324689269065857, + -4.414334774017334, + 2.973374605178833, + -12.369945526123047, + 4.680946350097656, + -9.247408866882324, + -2.8648624420166016, + 6.40486478805542, + 2.4516794681549072, + 4.884079456329346, + -0.44672244787216187, + 2.521172285079956, + -6.083702564239502, + 9.044846534729004, + 4.759283065795898, + 1.3962621688842773, + 1.185346245765686, + -1.959165334701538, + 1.8479242324829102, + 3.3530402183532715, + -3.986907958984375 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor options.bias and options.axes=[3, 1, 2]", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "bias": { + "shape": [3, 1, 4], + "data": [ + -0.1396923067429423, + -6.156772261512771, + 4.3632959655495505, + 8.859804790093527, + 9.772650559072677, + -3.4626546514711087, + 9.74495010474131, + -0.39589682596727016, + -8.497353592778571, + 6.1725369732984525, + -2.893046077750334, + 1.7220044503066347 + ], + "type": "float32" + }, + "axes": [3, 1, 2] + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -1.5454182624816895, + 10.312295913696289, + -8.713793754577637, + -7.139327049255371, + -2.691263198852539, + 6.088866710662842, + 5.825891971588135, + 8.931077003479004, + -2.1765193939208984, + 7.165213584899902, + 0.9449849724769592, + 2.087818145751953, + -1.6631782054901123, + 10.288921356201172, + -8.058714866638184, + -5.073605060577393, + -4.704574108123779, + 6.463997840881348, + 2.5836451053619385, + 9.159672737121582, + -1.5862356424331665, + 8.967641830444336, + 0.6360672116279602, + 2.0761911869049072 + ], + "type": "float32" + } + }, + { + "name": "layerNormalization float32 4D tensor all options", + "inputs": { + "input": { + "shape": [2, 1, 4, 3], + "data": [ + -35.51446620394829, + 54.735407789317094, + 19.65901979009459, + -15.882677905820188, + 65.48657727565143, + 25.818493353057278, + 97.5530279802174, + -8.057161374785466, + 62.941297318740425, + -48.91555566709158, + 91.90643767958213, + 46.67098666459884, + -74.85331462850246, + 30.12636276060539, + 26.130894553011203, + 59.302706651602165, + -60.36199702412532, + 18.556152152037427, + -88.0373081005649, + -26.566773146168643, + 70.81292942844541, + 9.1056120562301, + 56.66746139054709, + 21.78444497295007 + ], + "type": "float32" + } + }, + "options": { + "scale": { + "shape": [2, 3, 1], + "data": [ + 7.715926600551629, + 1.737107960115587, + 9.139651060226974, + 5.7588235611312335, + -2.8198351834129154, + -0.6866958235000595 + ], + "type": "float32" + }, + "bias": { + "shape": [2, 3, 1], + "data": [ + -8.71067229356711, + -7.642980873415213, + 4.937538370466076, + -2.1876746145760695, + -4.0676126709354765, + -6.83625459268332 + ], + "type": "float32" + }, + "axes": [0, 3, 1], + "epsilon": 1e-4 + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 3], + "data": [ + -15.487034797668457, + -5.628695964813232, + 8.29687786102295, + -14.294686317443848, + -5.639192581176758, + 7.11608362197876, + 0.7769554257392883, + -8.346451759338379, + 11.279659271240234, + -22.506288528442383, + -5.173816204071045, + 8.506545066833496, + -12.360523223876953, + -5.77052116394043, + -7.18900203704834, + 3.6336634159088135, + 0.8666883707046509, + -6.884884357452393, + -11.648612976074219, + -2.117840528488159, + -7.396423816680908, + -4.869131088256836, + -5.8111701011657715, + -6.714934349060059 + ], + "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..be810a90ce --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/leaky_relu.json @@ -0,0 +1,609 @@ +{ + "tests": [ + { + "name": "leakyRelu float32 1D constant 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", + "constant": true + } + }, + "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 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/lesser.json b/testing/web-platform/tests/webnn/resources/test_data/lesser.json new file mode 100644 index 0000000000..7527ea5c53 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/lesser.json @@ -0,0 +1,970 @@ +{ + "tests": [ + { + "name": "lesser float32 0D scalar", + "inputs": { + "a": { + "shape": [], + "data": [ + -0.5228080371919397 + ], + "type": "float32" + }, + "b": { + "shape": [], + "data": [ + 0.8150388698055 + ], + "type": "float32" + } + }, + "expected": { + "shape": [], + "data": [ + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 1D constant tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [24], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [24], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32" + } + }, + "expected": { + "shape": [24], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32" + } + }, + "expected": { + "shape": [4, 6], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 3, 4], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 2.9453755897484726, + 3.7304716829497266, + 4.025375190729793, + -4.718355239722074, + 6.773274305103257, + -2.042813441289626, + -6.526761957285996, + 6.826299715878466, + -9.267172939567224, + 6.118424090729771, + -2.0017322775193014, + 1.779831042224643, + 9.660093887317394, + -2.7473158972960476, + -3.4345008109025033, + -4.7510974486127955, + -6.092621934151237, + -0.43348063367342426, + -1.4069053013420518, + -0.23742098855005445, + -9.105970612932852, + 6.811780042167808, + -6.768326860738436, + -8.952353121501568 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 0, + 0, + 1, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 broadcast 0D to 4D", + "inputs": { + "a": { + "shape": [], + "data": [ + -5.678369818327527 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + -5.678369818327527 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data":[ + 3.5869946313397314, + -2.8533321455054805, + -3.684652687308483, + 2.4055018033797815, + -4.358371438779294, + 5.5484749560652915 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + -4.439523740453941, + 2.751832334938049, + 3.6359436309279225, + -2.808992101634189 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesser float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + -5.678369818327527 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -1.1472189199107738, + -8.409373914977403, + -2.2753309465448535, + -0.5770801181952088, + 8.171789524073006, + -0.907120961653046, + 5.290845327676683, + -3.9134646002455975, + 9.825094822582592, + -8.931730412646708, + -3.4574016573266553, + -7.331231867596579, + 1.2320041500405665, + 4.312076818806343, + 1.2715546106634825, + 4.184540686856884, + -6.710920186561022, + 3.0768423616317655, + 1.0030865825397903, + -9.076244529342748, + 8.907161848861044, + 4.232614785327211, + 2.1005889661509425, + -6.201345656840638 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + } + ] +} \ No newline at end of file diff --git a/testing/web-platform/tests/webnn/resources/test_data/lesser_or_equal.json b/testing/web-platform/tests/webnn/resources/test_data/lesser_or_equal.json new file mode 100644 index 0000000000..f47bd3b9d9 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/lesser_or_equal.json @@ -0,0 +1,970 @@ +{ + "tests": [ + { + "name": "lesserOrEqual float32 0D scalar", + "inputs": { + "a": { + "shape": [], + "data": [ + -6.978766599337822 + ], + "type": "float32" + }, + "b": { + "shape": [], + "data": [ + 6.613064588921308 + ], + "type": "float32" + } + }, + "expected": { + "shape": [], + "data": [ + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 1D constant tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [24], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "shape": [24], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 1D tensors", + "inputs": { + "a": { + "shape": [24], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [24], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32" + } + }, + "expected": { + "shape": [24], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 2D tensors", + "inputs": { + "a": { + "shape": [4, 6], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [4, 6], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32" + } + }, + "expected": { + "shape": [4, 6], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 3D tensors", + "inputs": { + "a": { + "shape": [2, 3, 4], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3, 4], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 3, 4], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 4D tensors", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 5D tensors", + "inputs": { + "a": { + "shape": [2, 2, 1, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 5.498841374763742, + 1.7662660534986596, + -2.815573112568557, + -6.048312187382399, + 9.49753657859197, + -2.1015747067374635, + -4.079037092104509, + 5.314039986892048, + 0.0387145550620982, + -0.30728287605858995, + 4.975426828050438, + 3.4626017503711424, + 8.605685214066689, + 1.5140481393702743, + 2.009095893644295, + -0.3105867764637402, + -4.244836158037981, + -3.5506834915660024, + -2.5953286338985615, + -4.999806170449843, + 3.1189506609780526, + 9.70514084988082, + 9.546739178733759, + -6.189505543544822 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 1, + 1, + 1, + 0, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 broadcast 0D to 4D", + "inputs": { + "a": { + "shape": [], + "data": [ + 4.840611135629258 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 broadcast 1D to 4D", + "inputs": { + "a": { + "shape": [1], + "data": [ + 4.840611135629258 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 broadcast 2D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [2, 3], + "data": [ + -8.499546963452499, + -8.321309725362518, + -7.182070889034953, + 3.418306360706925, + 5.389469370006754, + 6.9043128878217 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 1, + 1, + 1, + 0, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 0, + 1, + 1, + 0, + 0, + 0, + 0, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 broadcast 3D to 4D", + "inputs": { + "a": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 1], + "data": [ + 4.195140983741625, + 7.828658911400325, + 6.690202989995797, + 0.924701041097018 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 0, + 1, + 1, + 1, + 1, + 1, + 0 + ], + "type": "uint8" + } + }, + { + "name": "lesserOrEqual float32 broadcast 4D to 4D", + "inputs": { + "a": { + "shape": [1, 1, 1, 1], + "data": [ + 4.840611135629258 + ], + "type": "float32" + }, + "b": { + "shape": [2, 2, 2, 3], + "data": [ + -8.28400872674051, + -3.2192645259702735, + -6.543179908675301, + -0.5402850743134735, + -5.413843546081334, + 5.5837429023307585, + 1.5017805895450707, + 6.592243911021967, + -9.925486373960158, + -7.134800104191736, + -4.915772925181514, + -9.137166899591985, + 9.403683415346574, + -9.831502572671727, + -2.01231810920369, + -6.5976898409038665, + -8.269321065543842, + 8.281030248217476, + 1.645282309888799, + -1.486272662516086, + -4.998753723234106, + -0.9209934547883556, + -9.434256078100471, + 9.81323851825412 + ], + "type": "float32" + } + }, + "expected": { + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 1 + ], + "type": "uint8" + } + } + ] +} \ 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..6cbb84e9cb --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/linear.json @@ -0,0 +1,818 @@ +{ // linear: Calculate a linear function y = alpha * x + beta on the input tensor. + "tests": [ + { + "name": "linear float32 1D constant 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", + "constant": true + } + }, + "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 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..0481061272 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/log.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "log float32 positive 1D constant 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", + "constant": true + } + }, + "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 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/logical_not.json b/testing/web-platform/tests/webnn/resources/test_data/logical_not.json new file mode 100644 index 0000000000..3a37652a13 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/logical_not.json @@ -0,0 +1,421 @@ +{ + "tests": [ + { + "name": "logicalNot uint8 0D scalar", + "inputs": { + "x": { + "shape": [], + "data": [ + 1 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 1D constant tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + }, + { + "name": "logicalNot uint8 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 204, + 130, + 90, + 0, + 147, + 42, + 10, + 18, + 13, + 235, + 0, + 233, + 53, + 83, + 9, + 254, + 69, + 56, + 219, + 109, + 171, + 0, + 228, + 135 + ], + "type": "uint8" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 1, + 0, + 0 + ], + "type": "uint8" + } + } + ] +} \ 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..f3a03e442e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/matmul.json @@ -0,0 +1,1439 @@ +{ + "tests": [ + { + "name": "matmul float32 constant 1D and 1D tensors all positive produces a scalar", + "inputs": { + "a": { + "shape": [4], + "data": [ + 50.10142534731317, + 22.2193058046253, + 34.65448469299386, + 36.35148095671881 + ], + "type": "float32", + "constant": true + }, + "b": { + "shape": [4], + "data": [ + 27.829805134194842, + 83.14548502311283, + 34.4128942110155, + 83.20379675185079 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 7458.89013671875, + "type": "float32" + } + }, + { + "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 4D and 4D tensors", + "inputs": { + "a": { + "shape": [2, 1, 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, 1, 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, 1, 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..26285042d0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/max.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "max float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "expected": { + "name": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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..4532843d2b --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/max_pool2d.json @@ -0,0 +1,1439 @@ +{ + "tests": [ + { + "name": "maxPool2d float32 4D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 1], + "data": [ + 99.28312683105469, + 81.73119354248047 + ], + "type": "float32" + } + }, + { + "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..a08e651428 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/min.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "min float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "expected": { + "name": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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..3de9018427 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/mul.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "mul float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "expected": { + "name": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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..34dee53df1 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/neg.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "neg float32 1D constant 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", + "constant": true + } + }, + "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 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..53e8ed8f59 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/pad.json @@ -0,0 +1,797 @@ +{ + "tests": [ + { + "name": "pad float32 1D constant 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", + "constant": true + } + }, + "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 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..1738722b10 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/pow.json @@ -0,0 +1,880 @@ +{ + "tests": [ + { + "name": "pow float32 constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "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 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 (square) float32 4D base tensor and broadcastable 0D integer exponent scalar", + "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": [], + "data": [2], // square + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 318.4800720214844, + 0.00398249039426446, + 97.38143157958984, + 124.94144439697266, + 300.8932800292969, + 140.71298217773438, + 283.32550048828125, + 7.062208652496338, + 7.747018814086914, + 189.23854064941406, + 172.43321228027344, + 0.19152326881885529, + 245.8212890625, + 105.74638366699219, + 221.806640625, + 24.41554069519043, + 202.5444793701172, + 10.657630920410156, + 296.84356689453125, + 8.328523635864258, + 2.073643445968628, + 33.14323043823242, + 303.1522521972656, + 303.2897033691406 + ], + "type": "float32" + } + }, + { + "name": "pow (sqrt) float32 4D positive base tensor and broadcastable 0D integer exponent scalar", + "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": [], + "data": [0.5], // sqrt + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 1.19107186794281, + 4.402822494506836, + 3.6033201217651367, + 1.5685393810272217, + 2.7960963249206543, + 2.6352314949035645, + 3.490551710128784, + 4.23231315612793, + 3.369950771331787, + 2.9873480796813965, + 4.199621677398682, + 3.3906090259552, + 4.3030548095703125, + 1.5026806592941284, + 1.4939706325531006, + 3.6918632984161377, + 4.189082622528076, + 0.7342162132263184, + 2.4272139072418213, + 0.35781487822532654, + 4.4333391189575195, + 1.847233772277832, + 2.223743438720703, + 2.106442928314209 + ], + "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" + } + } + ] +} \ 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..cf79bee7a9 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/prelu.json @@ -0,0 +1,966 @@ +{ + "tests": [ + { + "name": "prelu float32 1D constant 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", + "constant": true + }, + "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": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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/reciprocal.json b/testing/web-platform/tests/webnn/resources/test_data/reciprocal.json new file mode 100644 index 0000000000..c71ac28005 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reciprocal.json @@ -0,0 +1,421 @@ +{ + "tests": [ + { + "name": "reciprocal float32 0D scalar", + "inputs": { + "x": { + "shape": [], + "data": [ + -9.363490722293237 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + -0.10679777711629868 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 1D constant tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "type": "float32" + } + }, + { + "name": "reciprocal float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + -1.011086269320547, + 4.6215385203163315, + 2.4173768502126727, + -8.934871773645101, + -3.348558485147799, + -8.803302423903414, + 8.82632175955639, + 6.572828698368518, + 6.639494748363678, + 2.6842704650429496, + -4.627160556770815, + -6.873653395070409, + -1.185412145486616, + 0.9572811852263605, + 0.021320551999082227, + 0.35645850544829827, + 4.827780063442164, + 1.312808185701284, + 8.246278209083616, + -0.20391698798075097, + -9.039937028172055, + 9.94280947774324, + -9.540112102987099, + -0.08022661906399975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + -0.9890353083610535, + 0.21637815237045288, + 0.4136715531349182, + -0.111921027302742, + -0.29863595962524414, + -0.11359372735023499, + 0.1132974773645401, + 0.1521414965391159, + 0.15061387419700623, + 0.3725407123565674, + -0.21611526608467102, + -0.14548304677009583, + -0.8435884118080139, + 1.044625163078308, + 46.90310287475586, + 2.805375576019287, + 0.20713452994823456, + 0.761725902557373, + 0.12126683443784714, + -4.903956413269043, + -0.11062023788690567, + 0.10057520121335983, + -0.10482056438922882, + -12.464690208435059 + ], + "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..7cbc442511 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_l1.json @@ -0,0 +1,743 @@ +{ + "tests": [ + { + "name": "reduceL1 float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 1092.72021484375, + "type": "float32" + } + }, + { + "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..7e59a45d5e --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_l2.json @@ -0,0 +1,743 @@ +{ + "tests": [ + { + "name": "reduceL2 float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 272.0996398925781, + "type": "float32" + } + }, + { + "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..250398d227 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum.json @@ -0,0 +1,663 @@ +{ + "tests": [ + { + "name": "reduceLogSum float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 7.039101600646973, + "type": "float32" + } + }, + { + "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..b7f39abd52 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_log_sum_exp.json @@ -0,0 +1,743 @@ +{ + "tests": [ + { + "name": "reduceLogSumExp float32 1D constant tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 1D tensor all positive default options", // default options: {axes: null, keepDimensions: false} + "inputs": { + "input": { + "shape": [24], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 1D tensor all negative default options", + "inputs": { + "input": { + "shape": [24], + "data": [ + -4.025670276125137, + -9.44434807349057, + -3.1193981742372, + -5.943697868896303, + -0.37018045102283637, + -4.3971262954406605, + -6.6059682563332744, + -5.534277354031625, + -7.361471172291552, + -1.9987547534811796, + -9.093968158437377, + -8.693618799659165, + -8.416788434713155, + -1.010741070662755, + -9.814584506221344, + -9.725259665431539, + -9.157071010493805, + -0.0016988189527857855, + -9.963414768875285, + -5.991659641614526, + -6.180599892028498, + -1.2336505614624649, + -0.44234340543470196, + -6.990072309054243 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 1.1666961908340454, + "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": [ + 1, + 5, + 7, + 5, + 7, + 5, + 4, + 2, + 1, + 5, + 8, + 2, + 4, + 1, + 4, + 5, + 4, + 8, + 6, + 2, + 7, + 7, + 8, + 5 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 9.607237815856934, + "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": [ + -6, + -3, + -5, + -1, + -9, + -5, + -1, + -2, + -10, + -1, + -5, + -7, + -7, + -3, + -10, + -10, + -8, + -6, + -2, + -6, + -1, + -9, + -5, + -2 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 0.7001367211341858, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 2D tensor default options", + "inputs": { + "input": { + "shape": [4, 6], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor default options", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor default options", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 5D tensor default options", + "inputs": { + "input": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "axes": [2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 8.55212688446045, + 3.985233783721924, + 5.52872896194458, + 9.081488609313965, + 6.996237754821777, + 9.759706497192383 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "axes": [0, 2] + }, + "expected": { + "name": "output", + "shape": [2, 3], + "data": [ + 4.66951847076416, + 9.08117961883545, + 8.533217430114746, + 9.270560264587402, + 6.450263977050781, + 8.917200088500977 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 3D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 3, 4], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1], + "data": [ + 10.39477825164795 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": false + }, + "expected": { + "name": "output", + "data": 10.39477825164795, + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "keepDimensions": true + }, + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + 10.39477825164795 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=false", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [2, 2], + "data": [ + 8.563796997070312, + 5.500619411468506, + 9.753945350646973, + 9.20864486694336 + ], + "type": "float32" + } + }, + { + "name": "reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=true", + "inputs": { + "input": { + "shape": [2, 2, 2, 3], + "data": [ + 0.7974132976078829, + 5.046889970229296, + 8.520371090961714, + 1.4063042363728728, + 0.11882661415275164, + 0.285854490277071, + 1.9325640291685864, + 3.7939957856803797, + 2.6040233063490925, + 4.937509735746763, + 4.571482286709769, + 0.7865120436262685, + 0.21018670996660216, + 9.063042370844672, + 4.099809553408898, + 4.596248815627706, + 0.2549232349678032, + 1.1594801326588255, + 6.802876838759606, + 5.23432518570901, + 8.914905562420849, + 9.166799240859705, + 5.71750713886038, + 0.3255050658627967 + ], + "type": "float32" + } + }, + "options": { + "axes": [1, 3] + }, + "expected": { + "name": "output", + "shape": [1, 2, 2, 1], + "data": [ + 8.563796997070312, + 5.500619411468506, + 9.753945350646973, + 9.20864486694336 + ], + "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..967aea8bf4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_max.json @@ -0,0 +1,623 @@ +{ + "tests": [ + { + "name": "reduceMax float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 99.77313232421875, + "type": "float32" + } + }, + { + "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..5a48952c06 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_mean.json @@ -0,0 +1,735 @@ +{ + "tests": [ + { + "name": "reduceMean float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 40.31047439575195, + "type": "float32" + } + }, + { + "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..92de75e92a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_min.json @@ -0,0 +1,623 @@ +{ + "tests": [ + { + "name": "reduceMin float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": -87.9623031616211, + "type": "float32" + } + }, + { + "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..691bf4da9b --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_product.json @@ -0,0 +1,623 @@ +{ + "tests": [ + { + "name": "reduceProduct float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 1.5855958784642327e+37, + "type": "float32" + } + }, + { + "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..df47a1a2b2 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum.json @@ -0,0 +1,735 @@ +{ + "tests": [ + { + "name": "reduceSum float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 1313.87939453125, + "type": "float32" + } + }, + { + "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..8ac373e4b3 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reduce_sum_square.json @@ -0,0 +1,743 @@ +{ + "tests": [ + { + "name": "reduceSumSquare float32 1D constant 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", + "constant": true + } + }, + "expected": { + "name": "output", + "data": 73275.859375, + "type": "float32" + } + }, + { + "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..248902c665 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/relu.json @@ -0,0 +1,401 @@ +{ + "tests": [ // relu input tensor of 1D to 5D with same data values + { + "name": "relu float32 1D constant 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", + "constant": true + } + }, + "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 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..ada3daa4e2 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/reshape.json @@ -0,0 +1,2056 @@ +{ + "tests": [ + { + "name": "reshape float32 tensor to a new shape (reorder all dimensions)", + "inputs": { + "input": { + "shape": [2, 3, 4], + "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" + } + }, + "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.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" + } + }, + "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.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" + } + }, + "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 (4D to 4D)", + "inputs": { + "input": { + "shape": [3, 2, 2, 2], + "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" + } + }, + "newShape": [4, 2, 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.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" + } + }, + "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 (squeeze) float32 2D tensor by eliminating one dimension", + "inputs": { + "input": { + "shape": [1, 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" + } + }, + "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 (squeeze) float32 3D tensor by eliminating one dimension", + "inputs": { + "input": { + "shape": [4, 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" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 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 (squeeze) float32 3D tensor by eliminating two dimensions", + "inputs": { + "input": { + "shape": [1, 24, 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" + } + }, + "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 (squeeze) float32 4D tensor by eliminating two dimensions", + "inputs": { + "input": { + "shape": [1, 4, 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" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 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 (squeeze) float32 4D tensor by eliminating all dimensions", + "inputs": { + "input": { + "shape": [1, 1, 1, 1], + "data": [ + -33.82555389404297 + ], + "type": "float32" + } + }, + "newShape": [], + "expected": { + "name": "output", + "shape": [], + "data": [ + -33.82555389404297 + ], + "type": "float32" + } + }, + { + "name": "reshape (squeeze) float32 5D tensor by eliminating four dimensions", + "inputs": { + "input": { + "shape": [1, 1, 1, 24, 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" + } + }, + "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 (squeeze) float32 2D tensor by eliminating 1st dimension", + "inputs": { + "input": { + "shape": [1, 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" + } + }, + "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 (squeeze) float32 3D tensor by eliminating 2nd and 3rd dimensions", + "inputs": { + "input": { + "shape": [24, 1, 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" + } + }, + "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 (squeeze) float32 4D tensor by eliminating 1st and 4th dimensions", + "inputs": { + "input": { + "shape": [1, 4, 6, 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" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 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 (squeeze) float32 5D tensor by eliminating 2nd and 3rd dimensions", + "inputs": { + "input": { + "shape": [2, 1, 1, 12, 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" + } + }, + "newShape": [2, 12, 1], + "expected": { + "name": "output", + "shape": [2, 12, 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 (squeeze) float32 5D tensor by eliminating 1st, 2nd and 5th dimensions", + "inputs": { + "input": { + "shape": [1, 1, 1, 24, 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" + } + }, + "newShape": [1, 24], + "expected": { + "name": "output", + "shape": [1, 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 (unsqueeze) float32 0D tensor to 4D", + "inputs": { + "input": { + "shape": [], + "data": [ + -33.82555389404297 + ], + "type": "float32" + } + }, + "newShape": [1, 1, 1, 1], + "expected": { + "name": "output", + "shape": [1, 1, 1, 1], + "data": [ + -33.82555389404297 + ], + "type": "float32" + } + }, + { + "name": "reshape (unsqueeze) float32 1D tensor by adding one dimension", + "inputs": { + "input": { + "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" + } + }, + "newShape": [1, 24], + "expected": { + "name": "output", + "shape": [1, 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 (unsqueeze) float32 1D tensor by adding two dimensions", + "inputs": { + "input": { + "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" + } + }, + "newShape": [1, 24, 1], + "expected": { + "name": "output", + "shape": [1, 24, 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 (unsqueeze) float32 1D tensor to 5D", + "inputs": { + "input": { + "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" + } + }, + "newShape": [1, 1, 1, 24, 1], + "expected": { + "name": "output", + "shape": [1, 1, 1, 24, 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 (unsqueeze) float32 1D tensor by adding 2nd and 3rd dimensions", + "inputs": { + "input": { + "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" + } + }, + "newShape": [24, 1, 1], + "expected": { + "name": "output", + "shape": [24, 1, 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 (unsqueeze) float32 2D tensor by adding one dimension", + "inputs": { + "input": { + "shape": [4, 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" + } + }, + "newShape": [4, 1, 6], + "expected": { + "name": "output", + "shape": [4, 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 (unsqueeze) float32 2D tensor by adding two dimensions", + "inputs": { + "input": { + "shape": [4, 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" + } + }, + "newShape": [1, 4, 1, 6], + "expected": { + "name": "output", + "shape": [1, 4, 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 (unsqueeze) float32 2D tensor by adding 1st dimension", + "inputs": { + "input": { + "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" + } + }, + "newShape": [1, 24], + "expected": { + "name": "output", + "shape": [1, 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 (unsqueeze) float32 2D tensor by adding 1st and 4th dimensions", + "inputs": { + "input": { + "shape": [4, 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" + } + }, + "newShape": [1, 4, 6, 1], + "expected": { + "name": "output", + "shape": [1, 4, 6, 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 (unsqueeze) float32 3D tensor by adding 2nd and 3rd dimensions", + "inputs": { + "input": { + "shape": [2, 12, 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" + } + }, + "newShape": [2, 1, 1, 12, 1], + "expected": { + "name": "output", + "shape": [2, 1, 1, 12, 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 (unsqueeze) float32 4D tensor by adding 2nd dimension", + "inputs": { + "input": { + "shape": [2, 2, 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" + } + }, + "newShape": [2, 1, 2, 2, 3], + "expected": { + "name": "output", + "shape": [2, 1, 2, 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 (unsqueeze) float32 5D tensor by adding 4th dimension", + "inputs": { + "input": { + "shape": [2, 1, 4, 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" + } + }, + "newShape": [2, 1, 4, 1, 3, 1], + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 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 (flatten) float32 3D tensor to 2D", + "inputs": { + "input": { + "shape": [2, 3, 4], + "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" + } + }, + "newShape": [2, 12], + "expected": { + "name": "output", + "shape": [2, 12], + "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 (flatten) float32 4D to 2D", + "inputs": { + "input": { + "shape": [2, 2, 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" + } + }, + "newShape": [4, 6], + "expected": { + "name": "output", + "shape": [4, 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 (flatten) float32 4D to 2D exclusive 1st dimension", + "inputs": { + "input": { + "shape": [2, 2, 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" + } + }, + "newShape": [1, 24], + "expected": { + "name": "output", + "shape": [1, 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 (flatten) float32 4D to 2D exclusive 4th dimension", + "inputs": { + "input": { + "shape": [2, 2, 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" + } + }, + "newShape": [24, 1], + "expected": { + "name": "output", + "shape": [24, 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" + } + } + ] +} \ 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..69756fbb9c --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sigmoid.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "sigmoid float32 1D constant 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", + "constant": true + } + }, + "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 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..1fe76df45f --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sin.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "sin float32 1D constant 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", + "constant": true + } + }, + "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 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..28cfd2c0e2 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/slice.json @@ -0,0 +1,311 @@ +{ + "tests": [ + { + "name": "slice float32 1D constant 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", + "constant": true + } + }, + "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 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..ebb12114fc --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/softmax.json @@ -0,0 +1,203 @@ +{ + "tests": [ + { + "name": "softmax float32 2D constant 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", + "constant": true + } + }, + "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 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/softplus.json b/testing/web-platform/tests/webnn/resources/test_data/softplus.json new file mode 100644 index 0000000000..eb05b7b281 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/softplus.json @@ -0,0 +1,539 @@ +{ // softplus: The calculation follows the expression ln(1 + exp(steepness * x)) / steepness. + "tests": [ + { + "name": "softplus float32 1D constant tensor default options", // default options: {steepness: 1} + "inputs": { + "x": { + "shape": [24], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus float32 1D tensor default options", // default options: {steepness: 1} + "inputs": { + "x": { + "shape": [24], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus float32 2D tensor default options", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus float32 3D tensor default options", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus float32 4D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus float32 5D tensor default options", + "inputs": { + "x": { + "shape": [1, 2, 1, 3, 4], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [1, 2, 1, 3, 4], + "data": [ + 5.630208969116211, + 5.1731696128845215, + 4.032524108886719, + 9.480109214782715, + 9.989983558654785, + 7.0662946701049805, + 2.2446866035461426, + 8.187429428100586, + 5.175644874572754, + 2.219529390335083, + 3.552403688430786, + 4.152195453643799, + 1.903303623199463, + 5.151034355163574, + 5.022127628326416, + 0.7163625359535217, + 3.007754325866699, + 3.978142499923706, + 5.521933078765869, + 7.1930742263793945, + 8.765081405639648, + 1.5991919040679932, + 8.930801391601562, + 8.660456657409668 + ], + "type": "float32" + } + }, + { + "name": "softplus both positive float32 4D tensor and options.steepness", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + 5.626614582460632, + 5.167487045486892, + 4.0146356193402655, + 9.48003299650489, + 9.989938045769978, + 7.0654412821434125, + 2.132681001794825, + 8.187151346059956, + 5.169976220175496, + 2.1044997879382077, + 3.523329401138895, + 4.136340646976668, + 1.7418719794295656, + 5.145224066290767, + 5.015515309165462, + 0.045903935074711466, + 2.9570898924917377, + 3.959244712098706, + 5.517926978255181, + 7.192322388417094, + 8.76492480390928, + 1.3734704039113388, + 8.930669016709397, + 8.660283210871246 + ], + "type": "float32" + } + }, + "options": { + "steepness": 1.5104469060897827 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + 5.626749515533447, + 5.167757034301758, + 4.016173362731934, + 9.480032920837402, + 9.989937782287598, + 7.065456390380859, + 2.158585548400879, + 8.187153816223145, + 5.170245170593262, + 2.1315081119537354, + 3.526555061340332, + 4.137620449066162, + 1.7879058122634888, + 5.145503044128418, + 5.015854835510254, + 0.4822517931461334, + 2.964651584625244, + 3.960916519165039, + 5.518085956573486, + 7.19233512878418, + 8.764925956726074, + 1.4518096446990967, + 8.930669784545898, + 8.660284042358398 + ], + "type": "float32" + } + }, + { + "name": "softplus both negative float32 4D tensor and options.steepness", + "inputs": { + "x": { + "shape": [1, 2, 3, 4], + "data": [ + -5.584833476104802, + -8.188738740810354, + -8.981280004134987, + -1.7315531899284586, + -0.7266543578958906, + -0.0034800119290885334, + -7.378389455552106, + -8.907525953796949, + -6.0483786568116304, + -6.328561142365743, + -2.6006513567654626, + -5.02005264196455, + -2.0647716093484414, + -1.5499896740695434, + -2.221591675966657, + -1.1088025713211636, + -2.7854626064634385, + -2.105037489961294, + -5.144277741727352, + -5.081219916574497, + -7.499426297617635, + -2.4305558382286545, + -8.390520024268328, + -0.07117499202643174 + ], + "type": "float32" + } + }, + "options": { + "steepness": -1.2985155767552126 + }, + "expected": { + "name": "output", + "shape": [1, 2, 3, 4], + "data": [ + -5.585379123687744, + -8.188756942749023, + -8.981287002563477, + -1.8088372945785522, + -0.9798305630683899, + -0.5355416536331177, + -7.378442287445068, + -8.907533645629883, + -6.048677444458008, + -6.328769207000732, + -2.626511573791504, + -5.021188259124756, + -2.1157851219177246, + -1.6465802192687988, + -2.2634570598602295, + -1.2725814580917358, + -2.805877923965454, + -2.1535322666168213, + -5.145244121551514, + -5.082269191741943, + -7.499471664428711, + -2.4626762866973877, + -8.390534400939941, + -0.5702091455459595 + ], + "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..290f6711d0 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/softsign.json @@ -0,0 +1,467 @@ +{ // softsign: The calculation follows the expression x / (1 + |x|). + "tests": [ + { + "name": "softsign positive float32 1D constant 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", + "constant": true + } + }, + "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 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..6432044ea2 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/split.json @@ -0,0 +1,744 @@ +{ + "tests": [ + { + "name": "split float32 1D constant 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", + "constant": true + } + }, + "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 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/sqrt.json b/testing/web-platform/tests/webnn/resources/test_data/sqrt.json new file mode 100644 index 0000000000..fa59308d45 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sqrt.json @@ -0,0 +1,421 @@ +{ + "tests": [ + { + "name": "sqrt float32 0D scalar", + "inputs": { + "x": { + "shape": [], + "data": [ + 4.004463832628975 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + 2.001115560531616 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 1D constant tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 1D tensor", + "inputs": { + "x": { + "shape": [24], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 2D tensor", + "inputs": { + "x": { + "shape": [4, 6], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [4, 6], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 3D tensor", + "inputs": { + "x": { + "shape": [2, 3, 4], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 4D tensor", + "inputs": { + "x": { + "shape": [2, 2, 2, 3], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "type": "float32" + } + }, + { + "name": "sqrt float32 5D tensor", + "inputs": { + "x": { + "shape": [2, 1, 4, 1, 3], + "data": [ + 7.256007082508322, + 7.786442153556337, + 1.3684587069592324, + 8.053416211473843, + 9.131288551146515, + 8.525780428509535, + 4.870553385406751, + 7.625959393700068, + 2.7050268401423483, + 8.709602770137977, + 3.2687935624375797, + 4.712883187439902, + 8.669182019771712, + 8.82960710328718, + 0.5529024533541915, + 7.95877117461449, + 4.096406313025051, + 7.919884221032476, + 4.424484759327438, + 0.09894099762703057, + 4.690024907987658, + 1.5277378145575349, + 5.929779749165696, + 6.06647154134714 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 1, 4, 1, 3], + "data": [ + 2.693697690963745, + 2.790419816970825, + 1.1698113679885864, + 2.8378541469573975, + 3.0218021869659424, + 2.919893980026245, + 2.20693302154541, + 2.7615139484405518, + 1.644696593284607, + 2.9512035846710205, + 1.8079805374145508, + 2.170917510986328, + 2.944347381591797, + 2.9714653491973877, + 0.7435740828514099, + 2.821129322052002, + 2.023958206176758, + 2.8142287731170654, + 2.1034460067749023, + 0.31454887986183167, + 2.165646553039551, + 1.2360169887542725, + 2.4351139068603516, + 2.4630208015441895 + ], + "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..207d9106b4 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/sub.json @@ -0,0 +1,882 @@ +{ + "tests": [ + { + "name": "sub float32 1D constant 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", + "constant": true + }, + "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", + "constant": true + } + }, + "expected": { + "name": "output", + "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 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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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": "output", + "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..63c7056d90 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/tan.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "tan float32 1D constant 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", + "constant": true + } + }, + "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 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..063c10623d --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/tanh.json @@ -0,0 +1,401 @@ +{ + "tests": [ + { + "name": "tanh float32 1D constant 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", + "constant": true + } + }, + "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 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..f7e6a7d2dd --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/transpose.json @@ -0,0 +1,746 @@ +{ + "tests": [ + { + "name": "transpose float32 1D constant 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", + "constant": true + } + }, + "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 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/test_data/where.json b/testing/web-platform/tests/webnn/resources/test_data/where.json new file mode 100644 index 0000000000..7c55b3171a --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/test_data/where.json @@ -0,0 +1,1817 @@ +{ + "tests": [ + { + "name": "where float32 0D scalars", + "inputs": { + "condition": { + "shape": [], + "data": [ + 247 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [], + "data": [ + -22.83924102783203 + ], + "type": "float32" + }, + "falseValues": { + "shape": [], + "data": [ + -50.02232360839844 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [], + "data": [ + -22.83924102783203 + ], + "type": "float32" + } + }, + { + "name": "where float32 1D constant tensors", + "inputs": { + "condition": { + "shape": [24], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8", + "constant": true + }, + "trueValues": { + "shape": [24], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32", + "constant": true + }, + "falseValues": { + "shape": [24], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32", + "constant": true + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 1D tensors", + "inputs": { + "condition": { + "shape": [24], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [24], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [24], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [24], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 2D tensors", + "inputs": { + "condition": { + "shape": [4, 6], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [4, 6], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [4, 6], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape":[4, 6], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 3D tensors", + "inputs": { + "condition": { + "shape": [2, 3, 4], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 3, 4], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 3, 4], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 3, 4], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors", + "inputs": { + "condition": { + "shape": [2, 2, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 5D tensors", + "inputs": { + "condition": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 1, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 1, 2, 3], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -21.683168411254883, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast condition 0D to 4D", + "inputs": { + "condition": { + "shape": [], + "data": [ + 247 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast condition 1D to 4D", + "inputs": { + "condition": { + "shape": [3], + "data": [ + 253, + 222, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -39.82423782348633, + -83.77035522460938, + 29.59670639038086, + -46.46003341674805, + -6.663239002227783, + -83.15333557128906, + 35.14354705810547, + -45.470706939697266, + 50.38861083984375, + 60.741416931152344, + 47.503013610839844, + -21.95842933654785, + 34.315250396728516, + -76.8262710571289, + 67.0030746459961, + 91.12223052978516, + -29.081029891967773, + -12.19106674194336, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast condition 2D to 4D", + "inputs": { + "condition": { + "shape": [2, 1], + "data": [ + 103, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast condition 3D to 4D", + "inputs": { + "condition": { + "shape": [1, 2, 3], + "data": [ + 235, + 0, + 93, + 213, + 0, + 117 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 66.7642593383789, + -1.5351932048797607, + -83.77035522460938, + -67.3449478149414, + -37.10446548461914, + -6.663239002227783, + 65.5730209350586, + -90.47624206542969, + -45.470706939697266, + 76.65287780761719, + 46.510799407958984, + 47.503013610839844, + -30.397233963012695, + 42.89878463745117, + -76.8262710571289, + -82.2353286743164, + 40.09717559814453, + -29.081029891967773, + 74.97810363769531, + -10.8577880859375, + -23.302522659301758, + 48.867103576660156, + -58.82704544067383 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast condition 4D to 4D", + "inputs": { + "condition": { + "shape": [1, 2, 2, 1], + "data": [ + 0, + 165, + 0, + 90 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast trueValues 2D to 4D", + "inputs": { + "condition": { + "shape": [2, 2, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 3], + "data": [ + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 38.77214050292969, + 66.7642593383789, + -11.542049407958984, + -21.683168411254883, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 65.5730209350586, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 18.20477294921875, + 18.877336502075195, + -82.74693298339844, + -18.61202621459961, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast trueValues 4D to 4D", + "inputs": { + "condition": { + "shape": [2, 2, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 1, 1], + "data": [ + -29.164173126220703, + 32.200286865234375, + -6.146966457366943, + -24.822790145874023 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 2, 3], + "data": [ + 90.44255065917969, + 66.7642593383789, + -39.82423782348633, + -21.683168411254883, + -67.3449478149414, + -46.46003341674805, + -55.907073974609375, + 65.5730209350586, + 35.14354705810547, + 11.960981369018555, + 76.65287780761719, + 60.741416931152344, + -93.93305206298828, + -30.397233963012695, + 34.315250396728516, + 7.7088470458984375, + -82.2353286743164, + 91.12223052978516, + 22.937334060668945, + 74.97810363769531, + 18.877336502075195, + 62.31299591064453, + 48.867103576660156, + -75.41789245605469 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + -29.164173126220703, + 66.7642593383789, + -29.164173126220703, + -21.683168411254883, + -29.164173126220703, + -29.164173126220703, + 32.200286865234375, + 65.5730209350586, + 32.200286865234375, + 32.200286865234375, + 32.200286865234375, + 32.200286865234375, + -6.146966457366943, + -6.146966457366943, + -6.146966457366943, + -6.146966457366943, + -6.146966457366943, + -6.146966457366943, + -24.822790145874023, + -24.822790145874023, + 18.877336502075195, + -24.822790145874023, + -24.822790145874023, + -75.41789245605469 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast falseValues 3D to 4D", + "inputs": { + "condition": { + "shape": [2, 2, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 1], + "data": [ + -86.59848022460938, + -67.72773742675781, + -30.731334686279297, + -93.49223327636719 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + -86.59848022460938, + -1.5351932048797607, + -67.72773742675781, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -30.731334686279297, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -30.731334686279297, + -23.302522659301758, + 30.851404190063477, + -93.49223327636719 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors only broadcast falseValues 4D to 4D", + "inputs": { + "condition": { + "shape": [2, 2, 2, 3], + "data": [ + 241, + 0, + 85, + 0, + 227, + 51, + 202, + 0, + 104, + 227, + 129, + 129, + 175, + 134, + 130, + 140, + 103, + 46, + 158, + 17, + 0, + 41, + 94, + 0 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + 89.99047088623047, + -1.5351932048797607, + -83.77035522460938, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + -83.15333557128906, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -10.8577880859375, + -23.302522659301758, + 30.851404190063477, + -58.82704544067383 + ], + "type": "float32" + }, + "falseValues": { + "shape": [1, 2, 1, 3], + "data": [ + 17.777414321899414, + -1.9890096187591553, + -57.28207015991211, + -80.01390838623047, + 66.87323760986328, + -31.328258514404297 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 70.27151489257812, + -1.9890096187591553, + -1.5351932048797607, + 17.777414321899414, + 29.59670639038086, + -37.10446548461914, + -6.663239002227783, + 66.87323760986328, + -90.47624206542969, + -45.470706939697266, + 50.38861083984375, + 46.510799407958984, + 47.503013610839844, + -21.95842933654785, + 42.89878463745117, + -76.8262710571289, + 67.0030746459961, + 40.09717559814453, + -29.081029891967773, + -12.19106674194336, + -31.328258514404297, + -23.302522659301758, + 30.851404190063477, + -31.328258514404297 + ], + "type": "float32" + } + }, + { + "name": "where float32 4D tensors all broadcast 4D", + "inputs": { + "condition": { + "shape": [2, 1, 1, 1], + "data": [ + 58, + 217 + ], + "type": "uint8" + }, + "trueValues": { + "shape": [2, 3], + "data": [ + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281 + ], + "type": "float32" + }, + "falseValues": { + "shape": [2, 2, 1], + "data":[ + -86.59848022460938, + -67.72773742675781, + -30.731334686279297, + -93.49223327636719 + ], + "type": "float32" + } + }, + "expected": { + "name": "output", + "shape": [2, 2, 2, 3], + "data": [ + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281, + 38.77214050292969, + 18.20477294921875, + -11.542049407958984, + -82.74693298339844, + -18.61202621459961, + -75.77534484863281 + ], + "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..f91d6622d3 --- /dev/null +++ b/testing/web-platform/tests/webnn/resources/utils.js @@ -0,0 +1,929 @@ +'use strict'; + +const ExecutionArray = ['sync', 'async']; + +// https://webmachinelearning.github.io/webnn/#enumdef-mloperanddatatype +const TypedArrayDict = { + // workaround use Uint16 for Float16 + float16: Uint16Array, + + float32: Float32Array, + int32: Int32Array, + uint32: Uint32Array, + int8: Int8Array, + uint8: Uint8Array, + int64: BigInt64Array, +}; + +const getTypedArrayData = (type, data) => { + let outData; + if (type === 'float16') { + // workaround to convert Float16 to Uint16 + outData = new TypedArrayDict[type](data.length); + for (let i = 0; i < data.length; i++) { + outData[i] = toHalf(data[i]); + } + } else if (type === 'int64') { + outData = new TypedArrayDict[type](data.length); + for (let i = 0; i < data.length; i++) { + outData[i] = BigInt(data[i]); + } + } else { + outData = new TypedArrayDict[type](data); + } + return outData; +}; + +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 = { + argMax: {ULP: {int64: 0}}, + argMin: {ULP: {int64: 0}}, + batchNormalization: {ULP: {float32: 6, float16: 6}}, + cast: {ULP: {float32: 1, float16: 1, int32: 0, uint32: 0, int64: 0, int8: 0, uint8: 0}}, + 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 logical operations + equal: {ULP: {uint8: 0}}, + greater: {ULP: {uint8: 0}}, + greaterOrEqual: {ULP: {uint8: 0}}, + lesser: {ULP: {uint8: 0}}, + lesserOrEqual: {ULP: {uint8: 0}}, + logicalNot: {ULP: {uint8: 0}}, + // End Element-wise logical 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}}, + erf: {ATOL: {float32: 1/1024, float16: 1/512}}, + exp: {ULP: {float32: 32, float16: 1}}, + floor: {ULP: {float32: 0, float16: 0}}, + identity: {ULP: {float32: 0, float16: 0}}, + log: {ATOL: {float32: 1/1024, float16: 1/1024}}, + neg: {ULP: {float32: 0, float16: 0}}, + reciprocal: {ULP: {float32: 2, float16: 2}}, + sin: {ATOL: {float32: 1/1024, float16: 1/512}}, + sqrt: {ULP: {float32: 1, float16: 1}}, + tan: {ATOL: {float32: 1/1024, float16: 1/512}}, + // End Element-wise unary operations + elu: {ULP: {float32: 18, float16: 18}}, + expand: {ULP: {float32: 0, float16: 0}}, + gather: {ULP: {float32: 0, float16: 0}}, + gemm: {ULP: {float32: getGemmPrecisionTolerance, float16: getGemmPrecisionTolerance}}, + instanceNormalization: {ULP: {float32: 840, float16: 8400}}, + hardSigmoid: {ULP: {float32: 2, float16: 2}}, + hardSwish: {ULP: {float32: 4, float16: 4}}, + layerNormalization: {ATOL: {float32: 1/1024, float16: 1/512}}, + 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}}, + softplus: {ULP: {float32: 18, float16: 18}}, + softsign: {ULP: {float32: 3, float16: 3}}, + split: {ULP: {float32: 0, float16: 0}}, + tanh: {ATOL: {float32: 1/1024, float16: 1/512}}, + transpose: {ULP: {float32: 0, float16: 0}}, + where: {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-mloperanddatatype + * @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-mloperanddatatype + * @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 + if (dataType === 'float32') { + actualBitwise = getBitwise(actual[i], dataType); + expectedBitwise = getBitwise(expected[i], dataType); + } else if (dataType === 'float16') { + actualBitwise = actual[i]; + // convert expected data of Float16 to Uint16 + expectedBitwise = toHalf(expected[i]); + } else if (dataType === 'int64') { + actualBitwise = actual[i]; + expectedBitwise = BigInt(expected[i]); + } + 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-mloperanddatatype + * @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.} namedOutputOperands + * @param {Object.} 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({dataType: resources.type, 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]; + let operand; + if (resources.inputs[inputOperandName].hasOwnProperty('constant') && resources.inputs[inputOperandName]['constant']) { + operand = createConstantOperand(builder, resources.inputs[inputOperandName]); + } else { + operand = builder.input(inputOperandName, {dataType: inputResources.type, type: inputResources.type, dimensions: inputResources.shape}); + } + return operand; +}; + +/** + * 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 => { + const 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; +}; + +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; +}; + +const buildCast = (operationName, builder, resources) => { + // MLOperand cast(MLOperand input, MLOperandDataType type); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.cast() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.type); + return namedOutputOperand; +}; + +const buildConcat = (operationName, builder, resources) => { + // MLOperand concat(sequence inputs, unsigned long axis); + const namedOutputOperand = {}; + const inputOperands = []; + let operand; + for (let input of resources.inputs) { + if (input.hasOwnProperty('constant') && input['constant']) { + operand = createConstantOperand(builder, input); + } else { + operand = builder.input(input.name, {dataType: input.type, type: input.type, dimensions: input.shape}); + } + inputOperands.push(operand); + } + // invoke builder.concat() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperands, resources.axis); + return namedOutputOperand; +}; + +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; +}; + +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; +}; + +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({dataType: 'float32', type: 'float32', dimensions: [1]}, new Float32Array([gemmOptions.c])); + } + } + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperandA, inputOperandB, gemmOptions); + return namedOutputOperand; +}; + +const buildLayerNorm = (operationName, builder, resources) => { + // MLOperand layerNormalization(MLOperand input, optional MLLayerNormalizationOptions options = {}); + // MLOperand instanceNormalization(MLOperand input, optional MLInstanceNormalizationOptions options = {}); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + const layerNormOptions = {...resources.options}; + if (layerNormOptions.scale) { + layerNormOptions.scale = createConstantOperand(builder, layerNormOptions.scale); + } + if (layerNormOptions.bias) { + layerNormOptions.bias = createConstantOperand(builder, layerNormOptions.bias); + } + // invoke builder.layerNormalization() or builder.instanceNormalization() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, layerNormOptions); + return namedOutputOperand; +}; + +const buildPad = (operationName, builder, resources) => { + // MLOperand pad(MLOperand input, sequence beginningPadding, sequence 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; +}; + +const buildReshape = (operationName, builder, resources) => { + // MLOperand reshape(MLOperand input, sequence newShape); + // MLOperand expand(MLOperand input, sequence newShape); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.reshape() or builder.expand() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.newShape); + return namedOutputOperand; +}; + +const buildSlice = (operationName, builder, resources) => { + // MLOperand slice(MLOperand input, sequence starts, sequence sizes); + const namedOutputOperand = {}; + const inputOperand = createSingleInputOperand(builder, resources); + // invoke builder.slice() + namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.starts, resources.sizes); + return namedOutputOperand; +}; + +const buildSplit = (operationName, builder, resources) => { + // sequence split(MLOperand input, + // (unsigned long or sequence) 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; +}; + +const buildWhere = (operationName, builder, resources) => { + // MLOperand where(MLOperand condition, MLOperand trueValues, MLOperand falseValues); + const namedOutputOperand = {}; + const [conditionOperand, trueValuesOperand, falseValuesOperand] = createMultiInputOperands(builder, resources); + // invoke builder.where() + namedOutputOperand[resources.expected.name] = builder[operationName](conditionOperand, trueValuesOperand, falseValuesOperand); + 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] = getTypedArrayData(subInput.type, subInput.data); + } + } + } else { + for (let inputName in resources.inputs) { + const subTestByName = resources.inputs[inputName]; + if (!subTestByName.hasOwnProperty('constant') || !subTestByName.constant) { + inputs[inputName] = getTypedArrayData(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 + * @param {String} deviceType - The execution device type for this test + */ +const testWebNNOperation = (operationName, buildFunc, deviceType = 'cpu') => { + 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({deviceType}); + 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({deviceType}); + builder = new MLGraphBuilder(context); + }); + for (const subTest of tests) { + promise_test(async () => { + await run(subOperationName, context, builder, subTest, buildFunc); + }, `${subTest.name} / ${executionType}`); + } + }); + } + }); +}; + +// ref: http://stackoverflow.com/questions/32633585/how-do-you-convert-to-half-floats-in-javascript +const toHalf = (value) => { + let floatView = new Float32Array(1); + let int32View = new Int32Array(floatView.buffer); + + /* This method is faster than the OpenEXR implementation (very often + * used, eg. in Ogre), with the additional benefit of rounding, inspired + * by James Tursa's half-precision code. */ + + floatView[0] = value; + let x = int32View[0]; + + let bits = (x >> 16) & 0x8000; /* Get the sign */ + let m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */ + let e = (x >> 23) & 0xff; /* Using int is faster here */ + + /* If zero, or denormal, or exponent underflows too much for a denormal + * half, return signed zero. */ + if (e < 103) { + return bits; + } + + /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ + if (e > 142) { + bits |= 0x7c00; + /* If exponent was 0xff and one mantissa bit was set, it means NaN, + * not Inf, so make sure we set one mantissa bit too. */ + bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff); + return bits; + } + + /* If exponent underflows but not too much, return a denormal */ + if (e < 113) { + m |= 0x0800; + /* Extra rounding may overflow and set mantissa to 0 and exponent + * to 1, which is OK. */ + bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1); + return bits; + } + + bits |= ((e - 112) << 10) | (m >> 1); + /* Extra rounding. An overflow will set mantissa to 0 and increment + * the exponent, which is OK. */ + bits += m & 1; + return bits; +}; \ 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..cb7acefc05 --- /dev/null +++ b/testing/web-platform/tests/webnn/slice.https.any.js @@ -0,0 +1,10 @@ +// 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 + +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/softplus.https.any.js b/testing/web-platform/tests/webnn/softplus.https.any.js new file mode 100644 index 0000000000..7096f64a04 --- /dev/null +++ b/testing/web-platform/tests/webnn/softplus.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API softplus operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softplus + +testWebNNOperation('softplus', 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..b6fc5b4d98 --- /dev/null +++ b/testing/web-platform/tests/webnn/split.https.any.js @@ -0,0 +1,10 @@ +// 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 + +testWebNNOperation('split', buildSplit); \ 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 diff --git a/testing/web-platform/tests/webnn/where.https.any.js b/testing/web-platform/tests/webnn/where.https.any.js new file mode 100644 index 0000000000..306128a814 --- /dev/null +++ b/testing/web-platform/tests/webnn/where.https.any.js @@ -0,0 +1,10 @@ +// META: title=test WebNN API where operation +// META: global=window,dedicatedworker +// META: script=./resources/utils.js +// META: timeout=long + +'use strict'; + +// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-where + +testWebNNOperation('where', buildWhere); \ No newline at end of file -- cgit v1.2.3