diff --git a/webnn/META.yml b/webnn/META.yml index 3f87fc8042d2b3..6b22a19db92039 100644 --- a/webnn/META.yml +++ b/webnn/META.yml @@ -1,4 +1,4 @@ -spec: https://webmachinelearning.github.io/webnn/ +spec: https://www.w3.org/TR/webnn/ suggested_reviewers: - dontcallmedom - Honry \ No newline at end of file diff --git a/webnn/conformance_tests/abs.https.any.js b/webnn/conformance_tests/abs.https.any.js new file mode 100644 index 00000000000000..ca9f3d3ca94fa0 --- /dev/null +++ b/webnn/conformance_tests/abs.https.any.js @@ -0,0 +1,320 @@ +// META: title=test WebNN API element-wise abs operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the absolute value of the input tensor, element-wise. +// +// MLOperand abs(MLOperand input); + + +const getAbsPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const absTests = [ + // abs tests + { + 'name': 'abs float32 positive 0D scalar', + 'graph': { + 'inputs': { + 'absInput': { + 'data': [49.837242126464844], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + 'data': [49.837242126464844], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 negative 0D scalar', + 'graph': { + 'inputs': { + 'absInput': { + 'data': [-91.03521728515625], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + 'data': [91.03521728515625], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 1D constant tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 1D tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 2D tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 3D tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 4D tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'abs float32 5D tensor', + 'graph': { + 'inputs': { + 'absInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'abs', + 'arguments': [{'input': 'absInput'}], + 'outputs': 'absOutput' + }], + 'expectedOutputs': { + 'absOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + absTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getAbsPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/add.https.any.js b/webnn/conformance_tests/add.https.any.js index 60fef8e0b4adb2..17c04d1d2c188d 100644 --- a/webnn/conformance_tests/add.https.any.js +++ b/webnn/conformance_tests/add.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise add operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,582 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary addition of the two input tensors. +// MLOperand add(MLOperand a, MLOperand b); -runWebNNConformanceTests('add', buildOperationWithTwoInputs); + +const getAddPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const addTests = [ + { + 'name': 'add float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -59.749725341796875, -44.81494140625, -87.93879699707031, + 1.8843363523483276, 84.89464569091797, 47.553653717041016, + 85.64292907714844, 43.02861404418945, -60.25821304321289, + 15.60616683959961, 70.60614776611328, -7.454866409301758, + -30.20689582824707, -97.69825744628906, -0.00984330102801323, + -77.67960357666016, 30.196685791015625, -59.19007110595703, + 89.3588638305664, 28.6798095703125, -29.72130584716797, + -90.6352310180664, 28.2818546295166, 27.662540435791016 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-59.361572265625], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -17.981124877929688, -70.45854187011719, -12.762019157409668, + 24.254032135009766, -68.12599182128906, 30.62627410888672 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -32.34067153930664, 43.12499237060547, 78.6887435913086, + -54.49899673461914 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-59.361572265625], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -43.333316802978516, -67.89795684814453, 26.462739944458008, + 36.74276351928711, -65.1773910522461, -87.70664978027344, + 65.27881622314453, -74.05226135253906, -13.827810287475586, + 6.981486797332764, 99.83751678466797, 55.802337646484375, + -75.57196044921875, 11.499507904052734, 17.110109329223633, + 95.81167602539062, 57.4474983215332, -57.175872802734375, + 27.719053268432617, -18.219209671020508, 52.653099060058594, + -69.99455261230469, 39.8216552734375, -29.986528396606445 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 large inputs', + 'graph': { + 'inputs': { + 'inputA': { + 'data': 89.32998657226562, + 'descriptor': {'dimensions': [6000, 6000], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': 77.24720764160156, + 'descriptor': {'dimensions': [6000, 6000], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + 'data': 166.5771942138672, + 'descriptor': {'dimensions': [6000, 6000], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'add float32 with special character names', + 'graph': { + 'inputs': { + '12-L#!.☺': { + 'data': [89.32998657226562], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + }, + '🤦🏼‍♂️124DS#!F': { + 'data': [77.24720764160156], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'add', + 'arguments': [{'a': '12-L#!.☺'}, {'b': '🤦🏼‍♂️124DS#!F'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + 'data': [166.5771942138672], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + addTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getAddPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/arg_min_max.https.any.js b/webnn/conformance_tests/arg_min_max.https.any.js index f309cdca4cf347..e730f5135e8a49 100644 --- a/webnn/conformance_tests/arg_min_max.https.any.js +++ b/webnn/conformance_tests/arg_min_max.https.any.js @@ -8,6 +8,602 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-argminmax +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-argminmax +// Return the index location of the minimum or maximum values of all the input +// values along the axis. +// +// dictionary MLArgMinMaxOptions { +// boolean keepDimensions = false; +// }; +// +// MLOperand argMin(MLOperand input, [EnforceRange] unsigned long axis, +// optional MLArgMinMaxOptions options = {}); +// MLOperand argMax(MLOperand input, [EnforceRange] unsigned long axis, +// optional MLArgMinMaxOptions options = {}); -runWebNNConformanceTests(['argMin', 'argMax'], buildArgMinMax); + +const getArgMinMaxPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {int64: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const argMinMaxTests = [ + // argMin tests + { + 'name': 'argMin float32 1D constant tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': + {'data': [7], 'descriptor': {'dimensions': [], 'dataType': 'int32'}} + } + } + }, + { + 'name': 'argMin float32 1D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': + {'data': [7], 'descriptor': {'dimensions': [], 'dataType': 'int32'}} + } + } + }, + { + 'name': 'argMin float32 2D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 2, 0, 1, 1], + 'descriptor': {'dimensions': [6], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 3D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 4D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + 'descriptor': {'dimensions': [1, 4, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 5D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 0}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + 'descriptor': {'dimensions': [1, 4, 1, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 4D tensor, axis=2', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [{'input': 'argminInput'}, {'axis': 2}], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [2, 2, 0, 0, 0, 0], + 'descriptor': {'dimensions': [2, 1, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 4D tensor, axis=0, options.keepDimensions=true', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [ + {'input': 'argminInput'}, {'axis': 0}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + 'descriptor': {'dimensions': [1, 1, 4, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMin float32 4D tensor, axis=0, options.keepDimensions=false', + 'graph': { + 'inputs': { + 'argminInput': { + 'data': [ + 3.8301241397857666, -24.986488342285156, 5.29998254776001, + -48.54866027832031, 40.308868408203125, 60.184295654296875, + -82.78385925292969, -96.50904083251953, 71.87028503417969, + 38.86639404296875, -39.14372634887695, 31.444366455078125, + -82.78385925292969, -96.50904083251953, -25.533889770507812, + -16.14226531982422, 66.63677215576172, 82.51197814941406, + -82.78385925292969, -96.50904083251953, 39.76872634887695, + 42.1504020690918, 82.66864013671875, 85.45269012451172 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMin', + 'arguments': [ + {'input': 'argminInput'}, {'axis': 0}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'argminOutput' + }], + 'expectedOutputs': { + 'argminOutput': { + 'data': [1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0], + 'descriptor': {'dimensions': [1, 4, 3], 'dataType': 'int32'} + } + } + } + }, + + // argMax tests + { + 'name': 'argMax float32 1D constant tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': + {'data': [3], 'descriptor': {'dimensions': [], 'dataType': 'int32'}} + } + } + }, + { + 'name': 'argMax float32 1D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': + {'data': [3], 'descriptor': {'dimensions': [], 'dataType': 'int32'}} + } + } + }, + { + 'name': 'argMax float32 2D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [1, 1, 1, 0, 0, 0], + 'descriptor': {'dimensions': [6], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 3D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 4D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'descriptor': {'dimensions': [1, 4, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 5D tensor, axis=0, default options', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 0}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + 'descriptor': {'dimensions': [1, 4, 1, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 4D tensor, axis=2', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [{'input': 'argmaxInput'}, {'axis': 2}], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [1, 2, 2, 1, 2, 2], + 'descriptor': {'dimensions': [2, 1, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 4D tensor, axis=3, options.keepDimensions=true', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [ + {'input': 'argmaxInput'}, {'axis': 3}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [2, 0, 2, 1, 2, 0, 2, 1], + 'descriptor': {'dimensions': [2, 1, 4, 1], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'argMax float32 4D tensor, axis=3, options.keepDimensions=false', + 'graph': { + 'inputs': { + 'argmaxInput': { + 'data': [ + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875, + -51.09362030029297, -6.53970193862915, 73.8133773803711, + 88.46114349365234, -5.294266700744629, -79.20668029785156, + -41.70176696777344, 73.8133773803711, 88.46114349365234, + -84.94000244140625, -61.48894119262695, -98.3387451171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'argMax', + 'arguments': [ + {'input': 'argmaxInput'}, {'axis': 3}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'argmaxOutput' + }], + 'expectedOutputs': { + 'argmaxOutput': { + 'data': [2, 0, 2, 1, 2, 0, 2, 1], + 'descriptor': {'dimensions': [2, 1, 4], 'dataType': 'int32'} + } + } + } + } +]; + +if (navigator.ml) { + argMinMaxTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getArgMinMaxPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/batch_normalization.https.any.js b/webnn/conformance_tests/batch_normalization.https.any.js index 569881f94f6d05..08dda14db28e78 100644 --- a/webnn/conformance_tests/batch_normalization.https.any.js +++ b/webnn/conformance_tests/batch_normalization.https.any.js @@ -8,6 +8,711 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-batchnorm +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-batchnorm +// Normalize the values of the input tensor using Batch-Normalization. +// +// dictionary MLBatchNormalizationOptions { +// MLOperand scale; +// MLOperand bias; +// [EnforceRange] unsigned long axis = 1; +// double epsilon = 1e-5; +// }; +// +// MLOperand batchNormalization( +// MLOperand input, MLOperand mean, MLOperand, variance, +// optional MLBatchNormalizationOptions options = {}); -runWebNNConformanceTests('batchNormalization', buildBatchNorm); + +const getBatchNormPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 6, float16: 6}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const batchNormTests = [ + { + 'name': + 'batchNormalization float32 2D tensor (mean and variance are non-constant) default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [ + -7.814267635345459, -95.64129638671875, 38.15440368652344, + -55.95203399658203, -87.86500549316406, -41.63645553588867 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + }, + 'bnVariance': { + 'data': [ + 60.31186294555664, 26.43260383605957, 53.275634765625, + 40.146121978759766, 59.41098403930664, 35.99981689453125 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 2D constant tensor default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}, + 'constant': true + }, + 'bnMean': { + 'data': [ + -7.814267635345459, -95.64129638671875, 38.15440368652344, + -55.95203399658203, -87.86500549316406, -41.63645553588867 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [ + 60.31186294555664, 26.43260383605957, 53.275634765625, + 40.146121978759766, 59.41098403930664, 35.99981689453125 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 2D tensor default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [ + -7.814267635345459, -95.64129638671875, 38.15440368652344, + -55.95203399658203, -87.86500549316406, -41.63645553588867 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [ + 60.31186294555664, 26.43260383605957, 53.275634765625, + 40.146121978759766, 59.41098403930664, 35.99981689453125 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 3D tensor default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [12.810380935668945, 63.13715362548828, -61.62983322143555], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [18.358240127563477, 41.847232818603516, 16.12828254699707], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D tensor default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 5D tensor default options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [6, 1, 1, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [35.4078254699707], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [40.93109893798828], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [6, 1, 1, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NCHW tensor options.axis=1', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + {'options': {'axis': 1}} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NHWC tensor options.axis=3', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 83.02227020263672, -40.90216064453125, + 64.08863830566406, -80.08049011230469, 56.96306228637695, + -63.376670837402344, -62.144378662109375, 37.37249755859375, + -46.790367126464844, -0.10012771934270859, 57.046478271484375, + 82.05680084228516, -21.35103988647461, -85.36802673339844, + -86.1164321899414, -96.93824005126953, 62.35185241699219, + 76.8831787109375, -9.359310150146484, -68.4724349975586, + 97.03362274169922, 80.20824432373047, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + {'options': {'axis': 3}} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NCHW tensor options.scale', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnScale': { + 'data': [65.50171661376953, -71.007568359375, -5.569730758666992], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + {'options': {'scale': 'bnScale'}} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NCHW tensor options.bias', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnBias': { + 'data': [64.2044677734375, 75.28591918945312, -84.57243347167969], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + {'options': {'bias': 'bnBias'}} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NCHW tensor options.epsilon', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 64.08863830566406, -63.376670837402344, + -46.790367126464844, 83.02227020263672, -80.08049011230469, + -62.144378662109375, -0.10012771934270859, -40.90216064453125, + 56.96306228637695, 37.37249755859375, 57.046478271484375, + 82.05680084228516, -86.1164321899414, 76.8831787109375, + 97.03362274169922, -21.35103988647461, -96.93824005126953, + -9.359310150146484, 80.20824432373047, -85.36802673339844, + 62.35185241699219, -68.4724349975586, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + {'options': {'epsilon': 0.000001}} + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'batchNormalization float32 4D NHWC tensor all options', + 'graph': { + 'inputs': { + 'bnInput': { + 'data': [ + -41.30733108520508, 83.02227020263672, -40.90216064453125, + 64.08863830566406, -80.08049011230469, 56.96306228637695, + -63.376670837402344, -62.144378662109375, 37.37249755859375, + -46.790367126464844, -0.10012771934270859, 57.046478271484375, + 82.05680084228516, -21.35103988647461, -85.36802673339844, + -86.1164321899414, -96.93824005126953, 62.35185241699219, + 76.8831787109375, -9.359310150146484, -68.4724349975586, + 97.03362274169922, 80.20824432373047, -12.10716724395752 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'bnMean': { + 'data': [51.629150390625, 99.36075592041016, -96.1473617553711], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnVariance': { + 'data': [30.448015213012695, 86.36219024658203, 73.88455200195312], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnScale': { + 'data': [65.50171661376953, -71.007568359375, -5.569730758666992], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'bnBias': { + 'data': [64.2044677734375, 75.28591918945312, -84.57243347167969], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'batchNormalization', + 'arguments': [ + {'input': 'bnInput'}, {'mean': 'bnMean'}, {'variance': 'bnVariance'}, + { + 'options': { + 'scale': 'bnScale', + 'bias': 'bnBias', + 'axis': 3, + 'epsilon': 0.000001 + } + } + ], + 'outputs': 'bnOutput' + }], + 'expectedOutputs': { + 'bnOutput': { + 'data': [ + -1039.0085734071204, 200.12613597546277, -120.36987167541395, + 212.10626540432202, 1446.3732126569944, -183.78396479879416, + -1300.9852072279227, 1309.3257094058545, -171.08979404258523, + -1104.0956031373803, 835.2536189871761, -183.83801576309426, + 425.3993215144054, 997.6290832897452, -91.55716013805052, + -1570.920072497096, 1575.1810627320297, -187.2757593197739, + 363.98524710447384, 906.0018322105, -102.5050592863526, + 603.1834043179756, 221.6277675074517, -139.02827100419768 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + batchNormTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getBatchNormPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/buffer.https.any.js b/webnn/conformance_tests/buffer.https.any.js index bc838ee7680cea..eece969d8a3434 100644 --- a/webnn/conformance_tests/buffer.https.any.js +++ b/webnn/conformance_tests/buffer.https.any.js @@ -9,7 +9,1110 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlbuffer +// https://www.w3.org/TR/webnn/#api-mlbuffer + +const bytesPerDataType = (dataType) => { + if (dataType === 'int8' || dataType === 'uint8') { + return 1; + } else if (dataType === 'float16') { + return 2; + } else if ( + dataType === 'float32' || dataType === 'int32' || dataType === 'uint32') { + return 4; + } else if (dataType === 'int64' || dataType === 'uint64') { + return 8; + } else { + throw new AssertionError(`Data type '${dataType}' is not supported`); + } +}; + +const sizeOfDescriptor = (descriptor) => { + return descriptor.dimensions.reduce( + (accumulator, currentValue) => accumulator * currentValue, + bytesPerDataType(descriptor.dataType)); +}; + +const getDescriptorFromBuffer = (buffer) => { + return {dataType: buffer.dataType, dimensions: buffer.shape}; +}; + +/** + * Checks if MLBuffer is implemented or not. + * @param {MLContext} mlContext - A ML context to test for MLBuffer support. + * @returns {Boolean} True if MLBuffer is supported; otherwise, False. + */ +const isMLBufferSupported = (mlContext) => { + return ( + createBuffer(mlContext, {dataType: 'int32', dimensions: [2, 2]}) !== + undefined); +}; + +/** + * WebNN buffer creation. + * @param {MLContext} context - the context used to create the buffer. + * @param {MLBufferDescriptor} bufferDescriptor - intended specs of the buffer. + * @returns {MLBuffer} the created buffer. + */ +const createBuffer = (context, bufferDescriptor) => { + let buffer; + try { + buffer = context.createBuffer(bufferDescriptor); + assert_equals( + buffer.dataType, bufferDescriptor.dataType, + 'buffer data types do not match'); + assert_array_equals( + buffer.shape, bufferDescriptor.dimensions, + 'buffer shapes do not match'); + } catch (e) { + assert_true(e instanceof DOMException); + assert_equals(e.name, 'NotSupportedError'); + } + return buffer; +}; + +/** + * WebNN destroy buffer twice test. + * @param {String} testName - The name of the test operation. + */ +const testDestroyWebNNBuffer = (testName) => { + let context; + let buffer; + promise_setup(async () => { + try { + context = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + buffer = createBuffer(context, {dataType: 'int32', dimensions: [2, 3]}); + }); + promise_test(async () => { + // MLBuffer is not supported for this deviceType. + if (buffer === undefined) { + return; + } + buffer.destroy(); + buffer.destroy(); + }, `${testName}`); +}; + +/** + * WebNN create buffer test. + * @param {String} testName - The name of the test operation. + * @param {MLBufferDescriptor} bufferDescriptor - The intended buffer specs. + */ +const testCreateWebNNBuffer = (testName, bufferDescriptor) => { + let context; + + promise_setup(async () => { + try { + context = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + }); + promise_test(async () => { + createBuffer(context, bufferDescriptor); + }, `${testName} / ${bufferDescriptor.dataType}`); +}; + +/** + * Same as above, but expect creating the buffer to fail. + * @param {String} testName - The name of the test operation. + * @param {MLBufferDescriptor} bufferDescriptor - The intended buffer specs. + */ +const testCreateWebNNBufferFails = (testName, bufferDescriptor) => { + let context; + + promise_setup(async () => { + try { + context = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + }); + promise_test(async () => { + assert_throws_js(TypeError, () => context.createBuffer(bufferDescriptor)); + }, `${testName} / ${bufferDescriptor.dataType}`); +}; + +/** + * Asserts the buffer data in MLBuffer matches expected. + * @param {MLContext} mlContext - The context used to create the buffer. + * @param {MLBuffer} mlBuffer - The buffer to read and compare data. + * @param {Array} expected - Array of the expected data in the buffer. + */ +const assert_buffer_data_equals = async (mlContext, mlBuffer, expected) => { + const actual = await mlContext.readBuffer(mlBuffer); + assert_array_equals( + new expected.constructor(actual), expected, + 'Read buffer data equals expected data.'); +}; + +/** + * WebNN write buffer operation test. + * @param {String} testName - The name of the test operation. + */ +const testWriteWebNNBuffer = (testName) => { + let mlContext; + promise_setup(async () => { + try { + mlContext = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + }); + + promise_test(async () => { + const descriptor = {dataType: 'int32', dimensions: [1]}; + let mlBuffer = createBuffer(mlContext, descriptor); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + const bufferByteLength = sizeOfDescriptor(descriptor); + let arrayBuffer = new ArrayBuffer(bufferByteLength); + + // Writing with a size that goes past that source buffer length. + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(arrayBuffer), /*srcOffset=*/ 0, + /*srcSize=*/ bufferByteLength + 1)); + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(arrayBuffer), /*srcOffset=*/ 3, + /*srcSize=*/ bufferByteLength)); + + // Writing with a source offset that is out of range of the source size. + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(arrayBuffer), + /*srcOffset=*/ bufferByteLength + 1)); + + // Writing with a source offset that is out of range of implicit copy size. + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(arrayBuffer), + /*srcOffset=*/ bufferByteLength + 1, /*srcSize=*/ undefined)); + + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(arrayBuffer), /*srcOffset=*/ undefined, + /*srcSize=*/ bufferByteLength + 1)); + + assert_throws_js( + TypeError, + () => mlContext.writeBuffer( + mlBuffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE, 0xEE]))); + }, `${testName} / error`); + + promise_test(async () => { + const descriptor = {dataType: 'int32', dimensions: [2, 2]}; + let mlBuffer = createBuffer(mlContext, descriptor); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Writing data to a destroyed MLBuffer should throw. + mlBuffer.destroy(); + + assert_throws_dom( + 'InvalidStateError', + () => mlContext.writeBuffer( + mlBuffer, new Uint8Array(sizeOfDescriptor(descriptor)))); + }, `${testName} / destroy`); + + promise_test(async () => { + const bufferDescriptor = {dataType: 'int32', dimensions: [2, 3]}; + let mlBuffer = createBuffer(mlContext, bufferDescriptor); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + let anotherMLContext = await navigator.ml.createContext(contextOptions); + let anotherMLBuffer = createBuffer(anotherMLContext, bufferDescriptor); + + let inputData = + new Uint8Array(sizeOfDescriptor(bufferDescriptor)).fill(0xAA); + assert_throws_js( + TypeError, () => mlContext.writeBuffer(anotherMLBuffer, inputData)); + assert_throws_js( + TypeError, () => anotherMLContext.writeBuffer(mlBuffer, inputData)); + }, `${testName} / context_mismatch`); +}; + +/** + * WebNN read buffer operation test. + * @param {String} testName - The name of the test operation. + */ +const testReadWebNNBuffer = (testName) => { + let mlContext; + promise_setup(async () => { + try { + mlContext = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + }); + + promise_test(async t => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [2, 2]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Reading a destroyed MLBuffer should reject. + mlBuffer.destroy(); + + await promise_rejects_dom( + t, 'InvalidStateError', mlContext.readBuffer(mlBuffer)); + }, `${testName} / destroy`); + + promise_test(async () => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [1]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Initialize the buffer. + mlContext.writeBuffer(mlBuffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); + + mlContext.writeBuffer(mlBuffer, Uint32Array.from([0xBBBBBBBB])); + await assert_buffer_data_equals( + mlContext, mlBuffer, Uint32Array.from([0xBBBBBBBB])); + ; + }, `${testName} / full_size`); + + promise_test(async () => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [1]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Initialize the buffer. + mlContext.writeBuffer(mlBuffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); + + // Writing to the remainder of the buffer from source offset. + mlContext.writeBuffer( + mlBuffer, Uint8Array.from([0xCC, 0xCC, 0xBB, 0xBB]), + /*srcOffset=*/ 2); + await assert_buffer_data_equals( + mlContext, mlBuffer, Uint8Array.from([0xBB, 0xBB, 0xAA, 0xAA])); + }, `${testName} / src_offset_only`); + + promise_test(async () => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [1]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Initialize the buffer. + mlContext.writeBuffer(mlBuffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); + + // Writing with both a source offset and size. + mlContext.writeBuffer( + mlBuffer, Uint8Array.from([0xDD, 0xDD, 0xCC, 0xDD]), + /*srcOffset=*/ 2, /*srcSize=*/ 1); + await assert_buffer_data_equals( + mlContext, mlBuffer, Uint8Array.from([0xCC, 0xAA, 0xAA, 0xAA])); + }, `${testName} / src_offset_and_size`); + + promise_test(async () => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [1]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + // Initialize the buffer. + mlContext.writeBuffer(mlBuffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); + + // Using an offset allows a larger source buffer to fit. + mlContext.writeBuffer( + mlBuffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE, 0xEE]), + /*srcOffset=*/ 1); + await assert_buffer_data_equals( + mlContext, mlBuffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE])); + }, `${testName} / larger_src_data`); + + promise_test(async () => { + let mlBuffer = + createBuffer(mlContext, {dataType: 'int32', dimensions: [1]}); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + const inputData = [0xAA, 0xAA, 0xAA, 0xAA]; + + // Writing with a source offset of undefined should be treated as 0. + mlContext.writeBuffer( + mlBuffer, Uint8Array.from(inputData), /*srcOffset=*/ undefined, + /*srcSize=*/ inputData.length); + await assert_buffer_data_equals( + mlContext, mlBuffer, Uint8Array.from(inputData)); + }, `${testName} / no_src_offset`); + + promise_test(async t => { + const bufferDescriptor = {dataType: 'int32', dimensions: [2, 3]}; + let mlBuffer = createBuffer(mlContext, bufferDescriptor); + + // MLBuffer was unsupported for the deviceType. + if (mlBuffer === undefined) { + return; + } + + let anotherMLContext = await navigator.ml.createContext(contextOptions); + let anotherMLBuffer = createBuffer(anotherMLContext, bufferDescriptor); + + await promise_rejects_js( + t, TypeError, mlContext.readBuffer(anotherMLBuffer)); + await promise_rejects_js( + t, TypeError, anotherMLContext.readBuffer(mlBuffer)); + }, `${testName} / context_mismatch`); +}; + +/** + * WebNN dispatch buffer operation test. + * @param {String} testName - The name of the test operation. + */ +const testDispatchWebNNBuffer = (testName) => { + let mlContext; + let mlGraph; + const shape = [3, 5]; + let inputs = {}; + let outputs = {}; + promise_setup(async () => { + try { + mlContext = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + // Construct a simple graph: A = B + C, with two outputs. + const builder = new MLGraphBuilder(mlContext); + const descriptor = {dataType: 'float32', dimensions: shape}; + const lhsOperand = builder.input('lhs', descriptor); + const rhsOperand = builder.input('rhs', descriptor); + const output1Operand = builder.add(lhsOperand, rhsOperand); + const output2Operand = builder.add(lhsOperand, rhsOperand); + mlGraph = await builder.build( + {'output1': output1Operand, 'output2': output2Operand}); + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + inputs = { + 'lhs': mlContext.createBuffer(descriptor), + 'rhs': mlContext.createBuffer(descriptor), + }; + outputs = { + 'output1': mlContext.createBuffer(descriptor), + 'output2': mlContext.createBuffer(descriptor), + }; + }); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + let anotherMLContext = await navigator.ml.createContext(contextOptions); + + // Control case, same context. + mlContext.dispatch(mlGraph, inputs, outputs); + + // Test the wrong context being used for inputs. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': anotherMLContext.createBuffer( + getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': inputs['rhs'], + }, + outputs)); + + // Test the wrong context being used for outputs. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': anotherMLContext.createBuffer( + getDescriptorFromBuffer(outputs['output1'])), + 'output2': outputs['output2'], + })); + }, `${testName} / context_mismatch`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + // Control case, valid buffers. + mlContext.dispatch(mlGraph, inputs, outputs); + + // Input is a different shape. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': mlContext.createBuffer({ + dataType: inputs['lhs'].dataType, + // Input rank is too high. + dimensions: inputs['lhs'].shape.concat([2]) + }), + 'rhs': inputs['rhs'], + }, + outputs)); + + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': inputs['lhs'], + 'rhs': mlContext.createBuffer({ + dataType: inputs['rhs'].dataType, + // Input rank is too low. + dimensions: inputs['rhs'].shape.slice(1) + }), + }, + outputs)); + + // Output is a different shape. Dimension value is too large. + let output1WrongShape = [...outputs['output1'].shape]; + output1WrongShape[0] += 2; + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': mlContext.createBuffer({ + dataType: outputs['output1'].dataType, + dimensions: output1WrongShape + }), + 'output2': outputs['output2'], + })); + + // Output is a different shape. Dimension value is too small. + let output2WrongShape = [...outputs['output2'].shape]; + output2WrongShape[1] -= 1; + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'], + 'output2': mlContext.createBuffer({ + dataType: outputs['output2'].dataType, + dimensions: output2WrongShape + }), + })); + }, `${testName} / invalid shape`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + // Control case, valid buffers. + mlContext.dispatch(mlGraph, inputs, outputs); + + // Inputs are a different data type. + const inputWrongDataType = 'int32'; + assert_not_equals(inputs['lhs'].dataType, inputWrongDataType); + assert_not_equals(inputs['rhs'].dataType, inputWrongDataType); + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': mlContext.createBuffer({ + dataType: inputWrongDataType, + dimensions: inputs['lhs'].shape + }), + 'rhs': inputs['rhs'], + }, + outputs)); + + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': inputs['lhs'], + 'rhs': mlContext.createBuffer({ + dataType: inputWrongDataType, + dimensions: inputs['rhs'].shape + }), + }, + outputs)); + + // Outputs are a different data type. + const outputWrongDataType = 'int32'; + assert_not_equals(outputs['output1'].dataType, outputWrongDataType); + assert_not_equals(outputs['output2'].dataType, outputWrongDataType); + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': mlContext.createBuffer({ + dataType: outputWrongDataType, + dimensions: outputs['output1'].shape + }), + 'output2': outputs['output2'], + })); + + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'], + 'output2': mlContext.createBuffer({ + dataType: outputWrongDataType, + dimensions: outputs['output2'].shape + }), + })); + }, `${testName} / invalid data type`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + // Control case, valid names. + mlContext.dispatch(mlGraph, inputs, outputs); + + // No names is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, {}, {})); + + // Input name is invalid. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'aDifferentInputName': inputs['lhs'], + 'rhs': inputs['rhs'], + }, + outputs)); + + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': inputs['lhs'], + 'aDifferentInputName': inputs['rhs'], + }, + outputs)); + + // Output name is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'aDifferentOutputName': outputs['output1'], + 'output2': outputs['output2'], + })); + + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'], + 'aDifferentOutputName': outputs['output2'], + })); + + // Too few named inputs is invalid. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': inputs['lhs'], + }, + outputs)); + + // Too many named inputs is invalid. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': inputs['lhs'], + 'rhs': inputs['rhs'], + 'aDifferentInputName': mlContext.createBuffer( + getDescriptorFromBuffer(inputs['rhs'])), + }, + outputs)); + + // Too few named outputs is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'] + })); + + // Too many named outputs is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'], + 'output2': outputs['output2'], + 'aDifferentOutputName': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + })); + }, `${testName} / invalid_name`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + // Control case, valid buffers. + mlContext.dispatch(mlGraph, inputs, outputs); + + // Same buffer used as outputs more than once is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': outputs['output1'], + 'output2': outputs['output1'], + })); + + // Same buffer used as input and output is invalid. + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': inputs['lhs'], + 'output2': outputs['output2'], + })); + + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': outputs['output1'], + 'rhs': inputs['rhs'], + }, + outputs)); + + // Buffer that does not exist is invalid. + assert_throws_js( + TypeError, + () => mlContext.dispatch( + mlGraph, { + 'lhs': undefined, + 'rhs': inputs['rhs'], + }, + outputs)); + + assert_throws_js(TypeError, () => mlContext.dispatch(mlGraph, inputs, { + 'output1': undefined, + 'output2': outputs['output2'], + })); + }, `${testName} / invalid_buffer`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatch1Outputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + const dispatch2Outputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const inputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData); + + // Output_1 = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatch1Outputs); + + // Output_2 = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatch2Outputs); + + await assert_buffer_data_equals( + mlContext, dispatch1Outputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + + await assert_buffer_data_equals( + mlContext, dispatch1Outputs['output2'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + + await assert_buffer_data_equals( + mlContext, dispatch2Outputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + + await assert_buffer_data_equals( + mlContext, dispatch2Outputs['output2'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + }, `${testName} / same_inputs`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatch1Inputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatch2Inputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatchOutputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const input1Data = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatch1Inputs['lhs'], input1Data); + mlContext.writeBuffer(dispatch1Inputs['rhs'], input1Data); + + const input2Data = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); + mlContext.writeBuffer(dispatch2Inputs['lhs'], input2Data); + mlContext.writeBuffer(dispatch2Inputs['rhs'], input2Data); + + // Output = LHS_1 + RHS_1 = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatch1Inputs, dispatchOutputs); + + // Output = LHS_2 + RHS_2 = 2 + 2 = 4 + mlContext.dispatch(mlGraph, dispatch2Inputs, dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(4.0)); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output2'], + new Float32Array(sizeOfShape(shape)).fill(4.0)); + }, `${testName} / same_outputs`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatchOutputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const inputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData); + + // Output = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output2'], + new Float32Array(sizeOfShape(shape)).fill(2.0)); + }, `${testName} / same_inputs_and_outputs`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatch1Outputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + const dispatch2Outputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const inputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData); + + // Output_1 = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatch1Outputs); + + // Output_2 = Output_1_LHS + Output_1_RHS = 2 + 2 = 4 + mlContext.dispatch( + mlGraph, { + 'lhs': dispatch1Outputs['output1'], + 'rhs': dispatch1Outputs['output2'], + }, + dispatch2Outputs); + + // Output_1 = Output_2_LHS + Output_2_RHS = 4 + 4 = 8 + mlContext.dispatch( + mlGraph, { + 'lhs': dispatch2Outputs['output1'], + 'rhs': dispatch2Outputs['output2'], + }, + dispatch1Outputs); + + await assert_buffer_data_equals( + mlContext, dispatch1Outputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(8)); + + await assert_buffer_data_equals( + mlContext, dispatch1Outputs['output2'], + new Float32Array(sizeOfShape(shape)).fill(8)); + }, `${testName} / outputs_as_inputs`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + // Construct a simple graph: OUTPUT = LHS - RHS. + const builder = new MLGraphBuilder(mlContext); + const operandType = {dataType: 'float32', dimensions: shape}; + const lhsOperand = builder.input('lhs', operandType); + const rhsOperand = builder.input('rhs', operandType); + const graph = + await builder.build({'output': builder.sub(lhsOperand, rhsOperand)}); + + const lhsBuffer = + mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])); + const rhsBuffer = + mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])); + + const dispatchOutputs = { + 'output': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])) + }; + + // Initialize inputs + mlContext.writeBuffer( + lhsBuffer, new TypedArrayDict['float32'](sizeOfShape(shape)).fill(5.0)); + mlContext.writeBuffer( + rhsBuffer, new TypedArrayDict['float32'](sizeOfShape(shape)).fill(3.0)); + + // Output = LHS - RHS = 5 - 3 = 2 + mlContext.dispatch( + graph, { + 'lhs': lhsBuffer, + 'rhs': rhsBuffer, + }, + dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output'], + new Float32Array(sizeOfShape(shape)).fill(2)); + + // Output = RHS - LHS = 3 - 5 = -2 + mlContext.dispatch( + graph, { + 'lhs': rhsBuffer, + 'rhs': lhsBuffer, + }, + dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output'], + new Float32Array(sizeOfShape(shape)).fill(-2)); + }, `${testName} / same name diff input buffers`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const outputBuffer1 = + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])); + const outputBuffer2 = + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])); + + // Initialize inputs + const inputData1 = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData1); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData1); + + // Output = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, { + 'output1': outputBuffer1, + 'output2': outputBuffer2, + }); + + // Output = LHS + RHS = 2 + 2 = 4 + const inputData2 = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData2); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData2); + + mlContext.dispatch(mlGraph, dispatchInputs, { + 'output1': outputBuffer1, + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }); + + // Ensure the last dispatch() did not modify the original second output + // buffer. + await assert_buffer_data_equals( + mlContext, outputBuffer2, new Float32Array(sizeOfShape(shape)).fill(2)); + }, `${testName} / same name diff outputs buffers`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatchOutputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const inputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData); + + // Output = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + // Check destroyed input buffers cannot be re-used in subsequent dispatches. + dispatchInputs['lhs'].destroy(); + dispatchInputs['lhs'] = + mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])); + + const newInputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); + mlContext.writeBuffer(dispatchInputs['lhs'], newInputData); + + // Output = LHS + RHS = 2 + 1 = 3 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(3)); + + dispatchInputs['rhs'].destroy(); + dispatchInputs['rhs'] = + mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])); + mlContext.writeBuffer(dispatchInputs['rhs'], newInputData); + + // Output = LHS + RHS = 2 + 2 = 4 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(4)); + }, `${testName} / same name diff inputs buffers destroy`); + + promise_test(async () => { + // MLBuffer was unsupported for the deviceType. + if (!isMLBufferSupported(mlContext)) { + return; + } + + const dispatchInputs = { + 'lhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), + 'rhs': mlContext.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), + }; + + const dispatchOutputs = { + 'output1': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])), + 'output2': + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output2'])), + }; + + // Initialize inputs + const inputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); + mlContext.writeBuffer(dispatchInputs['lhs'], inputData); + mlContext.writeBuffer(dispatchInputs['rhs'], inputData); + + // Output = LHS + RHS = 1 + 1 = 2 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + // Check destroyed output buffers cannot be re-used in subsequent + // dispatches. + dispatchOutputs['output1'].destroy(); + dispatchOutputs['output1'] = + mlContext.createBuffer(getDescriptorFromBuffer(outputs['output1'])); + + const newInputData = + new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); + mlContext.writeBuffer(dispatchInputs['lhs'], newInputData); + + // Output = LHS + RHS = 2 + 1 = 3 + mlContext.dispatch(mlGraph, dispatchInputs, dispatchOutputs); + + await assert_buffer_data_equals( + mlContext, dispatchOutputs['output1'], + new Float32Array(sizeOfShape(shape)).fill(3)); + }, `${testName} / same name diff outputs buffers destroy`); +}; if (navigator.ml) { testCreateWebNNBuffer('create', {dataType: 'float16', dimensions: [2, 3]}); diff --git a/webnn/conformance_tests/cast.https.any.js b/webnn/conformance_tests/cast.https.any.js index 29f197a1aa6c20..a4223736f61217 100644 --- a/webnn/conformance_tests/cast.https.any.js +++ b/webnn/conformance_tests/cast.https.any.js @@ -8,6 +8,1418 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-cast +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-cast +// Cast each element in the input tensor to the target data type. +// MLOperand cast(MLOperand input, MLOperandDataType type); -runWebNNConformanceTests('cast', buildCast); + +const getCastPrecisionTolerance = (graphResources) => { + const toleranceValueDict = { + float32: 1, + float16: 1, + int32: 0, + uint32: 0, + int64: 0, + int8: 0, + uint8: 0 + }; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const castTests = [ + { + 'name': 'cast float32 0D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + 'data': [84.77753448486328], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + 'data': [84], + 'descriptor': {'dimensions': [], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 1D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 2D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 3D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 5D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to uint32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + }, + { + 'name': 'cast float32 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to uint32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + }, + { + 'name': 'cast float16 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast int32 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast int32 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast int32 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast int32 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + }, + { + 'name': 'cast int32 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + }, + { + 'name': 'cast uint32 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to uint32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + }, + { + 'name': 'cast int64 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to uint32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast int8 4D tensor to uint8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to float32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to float16', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'float16'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to int32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int32'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to uint32', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'uint32'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint32'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to int64', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int64'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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' + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int64'} + } + } + } + }, + { + 'name': 'cast uint8 4D tensor to int8', + 'graph': { + 'inputs': { + 'castInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'cast', + 'arguments': [{'input': 'castInput'}, {'type': 'int8'}], + 'outputs': 'castOutput' + }], + 'expectedOutputs': { + 'castOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'int8'} + } + } + } + } +]; + +if (navigator.ml) { + castTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getCastPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/ceil.https.any.js b/webnn/conformance_tests/ceil.https.any.js new file mode 100644 index 00000000000000..2e490bd1ecb071 --- /dev/null +++ b/webnn/conformance_tests/ceil.https.any.js @@ -0,0 +1,260 @@ +// META: title=test WebNN API element-wise ceil operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the ceiling of the input tensor, element-wise. +// +// MLOperand ceil(MLOperand input); + + +const getCeilPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const ceilTests = [ + { + 'name': 'ceil float32 0D scalar', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [67.38941955566406], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + 'data': [68], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 1D constant tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 1D tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 2D tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 3D tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 4D tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'ceil float32 5D tensor', + 'graph': { + 'inputs': { + 'ceilInput': { + 'data': [ + 67.38941955566406, 36.78218460083008, 99.10649108886719, + -22.58710479736328, 32.70173645019531, 17.68880844116211, + 5.631034851074219, 12.965238571166992, 83.1319351196289, + -29.292461395263672, 19.84463119506836, 65.2790298461914, + 26.31110954284668, 24.285673141479492, -48.39767074584961, + -5.617412567138672, 61.53380584716797, -87.81197357177734, + 69.71428680419922, 5.0031023025512695, 84.36833953857422, + -9.390542030334473, -27.856616973876953, -34.895931243896484 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'ceil', + 'arguments': [{'input': 'ceilInput'}], + 'outputs': 'ceilOutput' + }], + 'expectedOutputs': { + 'ceilOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + ceilTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getCeilPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/clamp.https.any.js b/webnn/conformance_tests/clamp.https.any.js index 15777271872bc1..5ccbe3b8e64b82 100644 --- a/webnn/conformance_tests/clamp.https.any.js +++ b/webnn/conformance_tests/clamp.https.any.js @@ -8,6 +8,911 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-clamp +// Clamp the input tensor element-wise within a range specified by the minimum +// and maximum values. +// +// dictionary MLClampOptions { +// MLNumber minValue; +// MLNumber maxValue; +// }; +// +// MLOperand clamp(MLOperand input, optional MLClampOptions options = {}); -runWebNNConformanceTests('clamp', buildOperationWithSingleInput); + +const getClampPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const clampTests = [ + { + 'name': 'clamp float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'clamp float32 1D tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'clamp float32 2D tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'clamp float32 3D tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'clamp float32 4D tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'clamp float32 5D tensor default options', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 4D tensor default options.maxValue and specified negative options.minValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'minValue': -1}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 3D tensor default options.maxValue and specified options.minValue=0.0', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [6, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'minValue': 0}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [6, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 2D tensor default options.maxValue and specified positive options.minValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'minValue': 1}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 5D tensor default options.minValue and specified negative options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'maxValue': -2}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 1D tensor default options.minValue and specified options.maxValue=0.0', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'maxValue': 0}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 3D tensor default options.minValue and specified positive options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [{'input': 'clampInput'}, {'options': {'maxValue': 3}}], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 5D tensor specified both negative options.minValue and options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 1, 1, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [ + {'input': 'clampInput'}, {'options': {'minValue': -8, 'maxValue': -1}} + ], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 1, 1, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 4D tensor specified negative options.minValue and options.maxValue=0.0', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 3, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [ + {'input': 'clampInput'}, {'options': {'minValue': -6, 'maxValue': 0}} + ], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 3D tensor specified negative options.minValue and positive options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 6, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [ + {'input': 'clampInput'}, {'options': {'minValue': -3, 'maxValue': 4}} + ], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 6, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 2D tensor specified options.minValue=0.0 and positive options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [6, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [ + {'input': 'clampInput'}, {'options': {'minValue': 0, 'maxValue': 6}} + ], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [6, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'clamp float32 1D tensor specified both positive options.minValue and options.maxValue', + 'graph': { + 'inputs': { + 'clampInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'clamp', + 'arguments': [ + {'input': 'clampInput'}, {'options': {'minValue': 2, 'maxValue': 7}} + ], + 'outputs': 'clampOutput' + }], + 'expectedOutputs': { + 'clampOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + clampTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getClampPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/compute-arraybufferview-with-bigger-arraybuffer.https.any.js b/webnn/conformance_tests/compute-arraybufferview-with-bigger-arraybuffer.https.any.js index 582a4c84d0e54d..e1e647ee50cf49 100644 --- a/webnn/conformance_tests/compute-arraybufferview-with-bigger-arraybuffer.https.any.js +++ b/webnn/conformance_tests/compute-arraybufferview-with-bigger-arraybuffer.https.any.js @@ -17,14 +17,12 @@ if (navigator.ml) { let context; promise_setup(async () => { - let supported = false; try { context = await navigator.ml.createContext(contextOptions); - supported = true; } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); } - assert_implements( - supported, `Unable to create context for ${variant} variant`); }); promise_test(async t => { diff --git a/webnn/conformance_tests/concat.https.any.js b/webnn/conformance_tests/concat.https.any.js index 3898ee7d6d864d..6beb089e84efd8 100644 --- a/webnn/conformance_tests/concat.https.any.js +++ b/webnn/conformance_tests/concat.https.any.js @@ -8,6 +8,2432 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-concat +// Concatenates the input tensors along a given axis. +// +// MLOperand concat( +// sequence inputs, [EnforceRange] unsigned long axis); -runWebNNConformanceTests('concat', buildConcat); + +const getConcatPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const buildGraphAndComputeWithConcat = + async (context, builder, graphResources) => { + const graphInputs = graphResources.inputs; + const operator = graphResources.operators[0]; + + const inputOperands = []; + const inputNameArray = + operator.arguments[0][Object.keys(operator.arguments[0])[0]]; + for (const inputName of inputNameArray) { + const operand = + createOperand(context, builder, inputName, graphInputs[inputName]); + inputOperands.push(operand); + } + + let outputOperand = builder[operator.name]( + inputOperands, + operator.arguments[1][Object.keys(operator.arguments[1])[0]]); + const outputOperandName = Object.keys(graphResources.expectedOutputs)[0]; + const expectedDescriptor = + graphResources.expectedOutputs[outputOperandName].descriptor; + if (!context.opSupportLimits().output.dataTypes.includes( + expectedDescriptor.dataType)) { + const compatibleType = findCompatibleType( + expectedDescriptor.dataType, + context.opSupportLimits().output.dataTypes); + outputOperand = builder.cast(outputOperand, compatibleType); + expectedDescriptor.castedType = compatibleType; + } + + assertDescriptorsEquals(outputOperand, expectedDescriptor); + + const namedOutputOperand = {}; + namedOutputOperand[outputOperandName] = outputOperand; + + // Compile the constructed graph. + const graph = await builder.build(namedOutputOperand); + + const inputs = {}; + prepareInputsForGraph(inputs, graphInputs); + + const outputs = {}; + prepareOutputsForGraph(outputs, graphResources.expectedOutputs); + + // Execute the compiled graph. + const result = await context.compute(graph, inputs, outputs); + return result; +}; + +const concatTests = [ + { + 'name': 'concat two float32 1D constant tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'}, + 'constant': true + }, + 'concatInput2': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat two float32 1D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat two float16 1D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat three float32 1D tensors of different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [4], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.576785683631897, 0.32276400923728943, -0.44735023379325867, + 0.11028251051902771, -0.5945112705230713, -0.402848482131958, + -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat three float16 1D tensors of different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [4], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.576785683631897, 0.32276400923728943, -0.44735023379325867, + 0.11028251051902771, -0.5945112705230713, -0.402848482131958, + -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat four float32 1D tensors of same 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat four float16 1D tensors of same 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [6], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat four float32 1D tensors of different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989], + 'descriptor': {'dimensions': [2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.337996244430542, -0.990639865398407, 0.576785683631897, + 0.32276400923728943 + ], + 'descriptor': {'dimensions': [4], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + -0.3418811559677124, -0.9158143401145935, -0.7206121683120728, + -0.7993468642234802, 0.6653800010681152, 0.03886038810014725, + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [10], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat four float16 1D tensors of different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989], + 'descriptor': {'dimensions': [2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.337996244430542, -0.990639865398407, 0.576785683631897, + 0.32276400923728943 + ], + 'descriptor': {'dimensions': [4], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + -0.3418811559677124, -0.9158143401145935, -0.7206121683120728, + -0.7993468642234802, 0.6653800010681152, 0.03886038810014725, + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [10], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat two float32 2D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [2, 6], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat two float16 2D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [2, 6], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 6], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 2D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 6], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 2D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 6], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 6], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat four float32 2D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat four float16 2D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 2D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [2, 10], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 1}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 2D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + '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 + ], + 'descriptor': {'dimensions': [2, 10], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 1}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat three float32 2D tensors of same shape along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat three float16 2D tensors of same shape along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [4, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat four float32 2D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [3, 1], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat four float16 2D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [3, 1], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124 + ], + 'descriptor': {'dimensions': [3, 2], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 3D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [2, 1, 3], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [6, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [8, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 3D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [2, 1, 3], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [6, 1, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [8, 1, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat four float32 3D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [3, 1, 1], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713 + ], + 'descriptor': {'dimensions': [3, 2, 1], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124 + ], + 'descriptor': {'dimensions': [3, 2, 1], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat four float16 3D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [3, 1, 1], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713 + ], + 'descriptor': {'dimensions': [3, 2, 1], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.402848482131958, -0.9531654119491577, -0.6731740236282349, + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124 + ], + 'descriptor': {'dimensions': [3, 2, 1], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [3, 3, 1], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 8, 1], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat three float32 3D tensors of same shape along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat three float16 3D tensors of same shape along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 6], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 4D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 3, 1, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 3, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 3, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 4D tensors of same others dimensions except different 1st dimension along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 3, 1, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 3, 1, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 0}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 3, 1, 2], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat three float32 4D tensors of same shape along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 6, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat three float16 4D tensors of same shape along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.5945112705230713, -0.402848482131958, -0.9531654119491577, + -0.6731740236282349, 0.49189892411231995, -0.15864109992980957, + -0.3418811559677124, -0.9158143401145935 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.7206121683120728, -0.7993468642234802, 0.6653800010681152, + 0.03886038810014725, 0.5182055234909058, -0.8742017149925232, + -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 1} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 6, 1, 2], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat three float32 4D tensors of same others dimensions except different 3rd dimension along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 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 + ], + 'descriptor': {'dimensions': [1, 2, 8, 1], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 12, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat three float16 4D tensors of same others dimensions except different 3rd dimension along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 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 + ], + 'descriptor': {'dimensions': [1, 2, 8, 1], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.5182055234909058, -0.8742017149925232, -0.4790218770503998, + 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 12, 1], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat four float32 4D tensors of same others dimensions except different 4th dimension along axis 3', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [1, 3, 1, 1], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [-0.990639865398407, 0.576785683631897, 0.32276400923728943], + 'descriptor': {'dimensions': [1, 3, 1, 1], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 3, 1, 2], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 3, 1, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 3} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 3, 1, 8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat four float16 4D tensors of same others dimensions except different 4th dimension along axis 3', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [-0.3944413363933563, 0.861982524394989, 0.337996244430542], + 'descriptor': {'dimensions': [1, 3, 1, 1], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [-0.990639865398407, 0.576785683631897, 0.32276400923728943], + 'descriptor': {'dimensions': [1, 3, 1, 1], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 3, 1, 2], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 3, 1, 4], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 3} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 3, 1, 8], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'concat four float32 5D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float32'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 1, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'concat four float16 5D tensors of same shape along axis 0', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -0.44735023379325867, 0.11028251051902771, -0.5945112705230713, + -0.402848482131958, -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float16'} + }, + 'concatInput4': { + 'data': [ + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + { + 'inputs': + ['concatInput1', 'concatInput2', 'concatInput3', 'concatInput4'] + }, + {'axis': 0} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 1, 1, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 5D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1, 1], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [1, 6, 3, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 1}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 8, 3, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 5D tensors of same others dimensions except different 2nd dimension along axis 1', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1, 1], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [1, 6, 3, 1, 1], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 1}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 8, 3, 1, 1], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat three float32 5D tensors of same others dimensions except different 3rd dimension along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + 0.576785683631897, 0.32276400923728943, -0.44735023379325867, + 0.11028251051902771, -0.5945112705230713, -0.402848482131958, + -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1, 2], 'dataType': 'float32'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 6, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat three float16 5D tensors of same others dimensions except different 3rd dimension along axis 2', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + 0.576785683631897, 0.32276400923728943, -0.44735023379325867, + 0.11028251051902771, -0.5945112705230713, -0.402848482131958, + -0.9531654119491577, -0.6731740236282349 + ], + 'descriptor': {'dimensions': [1, 2, 2, 1, 2], 'dataType': 'float16'} + }, + 'concatInput3': { + 'data': [ + 0.49189892411231995, -0.15864109992980957, -0.3418811559677124, + -0.9158143401145935, -0.7206121683120728, -0.7993468642234802, + 0.6653800010681152, 0.03886038810014725, 0.5182055234909058, + -0.8742017149925232, -0.4790218770503998, 0.1211843192577362 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': [ + {'inputs': ['concatInput1', 'concatInput2', 'concatInput3']}, + {'axis': 2} + ], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 6, 1, 2], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 5D tensors of same others dimensions except different 4th dimension along axis 3', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [3, 1, 1, 1, 2], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 3, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 3}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 4, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 5D tensors of same others dimensions except different 4th dimension along axis 3', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943 + ], + 'descriptor': {'dimensions': [3, 1, 1, 1, 2], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 3, 2], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 3}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 4, 2], 'dataType': 'float16'} + } + } + } + }, + { + 'name': + 'concat two float32 5D tensors of same others dimensions except different 5th dimension along axis 4', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 4], 'dataType': 'float32'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 8], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 4}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'concat two float16 5D tensors of same others dimensions except different 5th dimension along axis 4', + 'graph': { + 'inputs': { + 'concatInput1': { + 'data': [ + -0.3944413363933563, 0.861982524394989, 0.337996244430542, + -0.990639865398407, 0.576785683631897, 0.32276400923728943, + -0.44735023379325867, 0.11028251051902771 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 4], 'dataType': 'float16'} + }, + 'concatInput2': { + 'data': [ + -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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 8], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'concat', + 'arguments': + [{'inputs': ['concatInput1', 'concatInput2']}, {'axis': 4}], + 'outputs': 'concatOutput' + }], + 'expectedOutputs': { + 'concatOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 1, 12], 'dataType': 'float16'} + } + } + } + } +]; + +if (navigator.ml) { + concatTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndComputeWithConcat, getConcatPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/constant.https.any.js b/webnn/conformance_tests/constant.https.any.js deleted file mode 100644 index acc24e7772b4da..00000000000000 --- a/webnn/conformance_tests/constant.https.any.js +++ /dev/null @@ -1,13 +0,0 @@ -// META: title=test WebNN API constant -// META: global=window,dedicatedworker -// META: variant=?cpu -// META: variant=?gpu -// META: variant=?npu -// META: script=../resources/utils.js -// META: timeout=long - -'use strict'; - -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-constant-range - -runWebNNConformanceTests('constant', buildConstantRange); diff --git a/webnn/conformance_tests/conv2d.https.any.js b/webnn/conformance_tests/conv2d.https.any.js index f6e5ec0fa1dabc..b3354728634a9b 100644 --- a/webnn/conformance_tests/conv2d.https.any.js +++ b/webnn/conformance_tests/conv2d.https.any.js @@ -8,6 +8,1111 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-conv2d +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-conv2d +// Compute a 2-D convolution given 4-D input and filter tensors. +// +// enum MLConv2dFilterOperandLayout { +// "oihw", +// "hwio", +// "ohwi", +// "ihwo" +// }; +// +// dictionary MLConv2dOptions { +// sequence<[EnforceRange] unsigned long> padding; +// sequence<[EnforceRange] unsigned long> strides; +// sequence<[EnforceRange] unsigned long> dilations; +// [EnforceRange] unsigned long groups = 1; +// MLInputOperandLayout inputLayout = "nchw"; +// MLConv2dFilterOperandLayout filterLayout = "oihw"; +// MLOperand bias; +// }; +// +// MLOperand conv2d( +// MLOperand input, MLOperand filter, +// optional MLConv2dOptions options = {}); -runWebNNConformanceTests('conv2d', buildConv2d); + +const conv2dTests = [ + { + 'name': + 'conv2d float32 4D both input and filter non-constant tensors default options', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [{'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [ + 1.5323282480239868, 1.3573521375656128, 1.3641656637191772, + 1.071682333946228, 1.1259644031524658, 1.4713115692138672, + 1.078782320022583, 1.155018925666809, 1.656954288482666 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D both input and filter constant tensors default options', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [{'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [ + 1.5323282480239868, 1.3573521375656128, 1.3641656637191772, + 1.071682333946228, 1.1259644031524658, 1.4713115692138672, + 1.078782320022583, 1.155018925666809, 1.656954288482666 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors default options', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [{'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [ + 1.5323282480239868, 1.3573521375656128, 1.3641656637191772, + 1.071682333946228, 1.1259644031524658, 1.4713115692138672, + 1.078782320022583, 1.155018925666809, 1.656954288482666 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors options.padding', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'padding': [1, 1, 1, 1]}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors options.strides', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'strides': [2, 2]}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [ + 1.5323282480239868, 1.3641656637191772, 1.078782320022583, + 1.656954288482666 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors options.dilations', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.6124474406242371, 0.8857858777046204, 0.13667134940624237, + 0.5645291209220886, 0.8965172171592712, 0.36792829632759094, + 0.6811466217041016, 0.0479511022567749, 0.33355462551116943, + 0.19882695376873016, 0.41167140007019043, 0.07934240251779556, + 0.4272463321685791, 0.535800576210022, 0.5910806059837341, + 0.28415432572364807, 0.4147258698940277, 0.026906268671154976, + 0.3621256649494171, 0.9945681691169739, 0.07184549421072006, + 0.12204372137784958, 0.8422137498855591, 0.4537501037120819, + 0.21529443562030792 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.3804761469364166, 0.5280312299728394, 0.21947036683559418, + 0.36689770221710205, 0.33974137902259827, 0.4200059771537781, + 0.3805030882358551, 0.19443586468696594, 0.5686976909637451 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'dilations': [2, 2]}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [1.3599307537078857], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'depthwise conv2d float32 4D input and filter tensors options.groups= input_channels', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.8444867730140686, 0.9432409405708313, 0.6556113362312317, + 0.6982811689376831, 0.9994443655014038, 0.23663610219955444, + 0.36740678548812866, 0.2619246542453766, 0.6254158616065979, + 0.8403863906860352, 0.3783077001571655, 0.4543924033641815, + 0.25327208638191223, 0.5780375599861145, 0.5414554476737976, + 0.37846308946609497 + ], + 'descriptor': {'dimensions': [1, 4, 2, 2], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.27221617102622986, 0.281202495098114, 0.854483962059021, + 0.1796930730342865, 0.7762278318405151, 0.5140685439109802, + 0.6374202966690063, 0.12801742553710938, 0.8373776078224182, + 0.5726001858711243, 0.09855203330516815, 0.5929878950119019, + 0.5900803804397583, 0.9690897464752197, 0.23175589740276337, + 0.14805112779140472 + ], + 'descriptor': {'dimensions': [4, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'groups': 4}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + 'data': [ + 1.1808103322982788, 1.165167212486267, 1.311646819114685, + 0.8911385536193848 + ], + 'descriptor': {'dimensions': [1, 4, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nchw\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nchw'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nhwc\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nhwc'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.filterLayout=\'oihw\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'filterLayout': 'oihw'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.filterLayout=\'hwio\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.6952692270278931, 0.3072136342525482, + 0.9671129584312439, 0.5070913434028625, 0.43241235613822937, + 0.10836050659418106, 0.08139707148075104, 0.9849002361297607, + 0.3202308118343353, 0.5303338766098022, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'filterLayout': 'hwio'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.filterLayout=\'ohwi\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 2, 2, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'filterLayout': 'ohwi'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.filterLayout=\'ihwo\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.6952692270278931, 0.3072136342525482, + 0.9671129584312439, 0.5070913434028625, 0.43241235613822937, + 0.10836050659418106, 0.08139707148075104, 0.9849002361297607, + 0.3202308118343353, 0.5303338766098022, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [1, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'filterLayout': 'ihwo'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nhwc\' and options.filterLayout=\'oihw\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'oihw'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nhwc\' and options.filterLayout=\'hwio\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.6952692270278931, 0.3072136342525482, + 0.9671129584312439, 0.5070913434028625, 0.43241235613822937, + 0.10836050659418106, 0.08139707148075104, 0.9849002361297607, + 0.3202308118343353, 0.5303338766098022, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'hwio'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nhwc\' and options.filterLayout=\'ohwi\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 2, 2, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'ohwi'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors options.inputLayout=\'nhwc\' and options.filterLayout=\'ihwo\'', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.6952692270278931, 0.3072136342525482, + 0.9671129584312439, 0.5070913434028625, 0.43241235613822937, + 0.10836050659418106, 0.08139707148075104, 0.9849002361297607, + 0.3202308118343353, 0.5303338766098022, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [1, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'ihwo'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors 1D options.bias', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.7529087066650391, 0.7520291805267334, 0.5949527621269226, + 0.2163185328245163, 0.07589349150657654, 0.151067852973938, + 0.1212485060095787, 0.5364335179328918, 0.5937089920043945, + 0.991003155708313, 0.3630942404270172, 0.9289674162864685, + 0.22727376222610474, 0.5414124131202698, 0.08445341885089874, + 0.6765284538269043, 0.6193256378173828, 0.3929215967655182 + ], + 'descriptor': {'dimensions': [2, 1, 3, 3], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.14543837308883667, 0.9671129584312439, 0.10836050659418106, + 0.3202308118343353, 0.6952692270278931, 0.5070913434028625, + 0.08139707148075104, 0.5303338766098022, 0.3072136342525482, + 0.43241235613822937, 0.9849002361297607, 0.4281076192855835 + ], + 'descriptor': {'dimensions': [3, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + }, + 'conv2dBias': { + 'data': [0.8135762214660645, 0.8394582867622375, 0.49444812536239624], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, + {'options': {'bias': 'conv2dBias'}} + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'conv2d float32 4D input and filter tensors all options', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + 0.09971386939287186, 0.5374298095703125, 0.30570074915885925, + 0.7222362160682678, 0.5066556334495544, 0.3238430619239807, + 0.8721967935562134, 0.20989856123924255, 0.5052645802497864, + 0.026870572939515114, 0.5497115850448608, 0.06430311501026154, + 0.1560668647289276, 0.11970008909702301, 0.036145713180303574, + 0.41425615549087524, 0.2417246550321579, 0.6771785020828247, + 0.2087000161409378, 0.10979551076889038, 0.745035707950592, + 0.7443592548370361, 0.7873413562774658, 0.5887080430984497, + 0.11018028855323792, 0.9045036435127258, 0.11725221574306488, + 0.8508669137954712, 0.4244919717311859, 0.02537914551794529, + 0.747390866279602, 0.4645859897136688, 0.030408121645450592, + 0.4244018793106079, 0.3847547769546509, 0.7581132650375366, + 0.9901952147483826, 0.03716852888464928, 0.014496322721242905, + 0.8263142108917236, 0.21072064340114594, 0.6569713950157166, + 0.25842806696891785, 0.4802338480949402, 0.9704219102859497, + 0.2968284785747528, 0.7524365782737732, 0.029636209830641747, + 0.09028015285730362, 0.77818763256073 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.6385681629180908, 0.07764163613319397, 0.1291629821062088, + 0.45633891224861145, 0.40438535809516907, 0.5943626761436462, + 0.14241264760494232, 0.9036700129508972 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float32'}, + 'constant': true + }, + 'conv2dBias': { + 'data': [0.542375385761261, 0.8406118750572205], + 'descriptor': {'dimensions': [2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, { + 'options': { + 'padding': [1, 0, 0, 1], + 'strides': [1, 1], + 'dilations': [1, 1], + 'groups': 2, + 'inputLayout': 'nchw', + 'filterLayout': 'hwio', + 'bias': 'conv2dBias' + } + } + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'conv2d float32 4D input and filter tensors, both negative input tensor and options.bias', + 'graph': { + 'inputs': { + 'conv2dInput': { + 'data': [ + -0.8073334693908691, -0.8839999437332153, -0.7700487375259399, + -0.5646049380302429, -0.39717939496040344, -0.10841356962919235, + -0.5519214868545532, -0.3954172134399414, -0.057589758187532425, + -0.5144240856170654, -0.21321901679039001, -0.950609028339386, + -0.8043696880340576, -0.8646378517150879, -0.9607220888137817, + -0.3264438509941101, -0.06884296983480453, -0.3203399181365967, + -0.2692728042602539, -0.3430887758731842, -0.8989502191543579, + -0.9038569331169128, -0.6369403004646301, -0.20070797204971313, + -0.7870702147483826, -0.3467883765697479, -0.060042694211006165, + -0.14985208213329315, -0.6482332348823547, -0.8934088349342346, + -0.8149284720420837, -0.6423668265342712, -0.032736241817474365, + -0.6608918905258179, -0.5843491554260254, -0.09921254217624664, + -0.16602523624897003, -0.9508541822433472, -0.3051462769508362, + -0.6210587024688721, -0.5400903820991516, -0.42009180784225464, + -0.18824540078639984, -0.3588937520980835, -0.7114293575286865, + -0.3751019835472107, -0.7108227610588074, -0.36050301790237427, + -0.5468712449073792, -0.032261595129966736 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + }, + 'conv2dFilter': { + 'data': [ + 0.6385681629180908, 0.07764163613319397, 0.1291629821062088, + 0.45633891224861145, 0.40438535809516907, 0.5943626761436462, + 0.14241264760494232, 0.9036700129508972 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2], 'dataType': 'float32'}, + 'constant': true + }, + 'conv2dBias': { + 'data': [-0.37496936321258545, -0.4363507032394409], + 'descriptor': {'dimensions': [2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'conv2d', + 'arguments': [ + {'input': 'conv2dInput'}, {'filter': 'conv2dFilter'}, { + 'options': { + 'padding': [1, 0, 0, 1], + 'groups': 2, + 'filterLayout': 'hwio', + 'bias': 'conv2dBias' + } + } + ], + 'outputs': 'conv2dOutput' + }], + 'expectedOutputs': { + 'conv2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + conv2dTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getConv2dPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/conv_transpose2d.https.any.js b/webnn/conformance_tests/conv_transpose2d.https.any.js index 9e741a45d09f77..a76f180b556677 100644 --- a/webnn/conformance_tests/conv_transpose2d.https.any.js +++ b/webnn/conformance_tests/conv_transpose2d.https.any.js @@ -8,6 +8,1483 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-convtranspose2d +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-convtranspose2d +// Compute a 2-D transposed convolution given 4-D input and filter tensors. +// +// enum MLConvTranspose2dFilterOperandLayout { +// "iohw", +// "hwoi", +// "ohwi" +// }; +// +// dictionary MLConvTranspose2dOptions { +// sequence<[EnforceRange] unsigned long> padding; +// sequence<[EnforceRange] unsigned long> strides; +// sequence<[EnforceRange] unsigned long> dilations; +// sequence<[EnforceRange] unsigned long> outputPadding; +// sequence<[EnforceRange] unsigned long> outputSizes; +// [EnforceRange] unsigned long groups = 1; +// MLInputOperandLayout inputLayout = "nchw"; +// MLConvTranspose2dFilterOperandLayout filterLayout = "iohw"; +// MLOperand bias; +// }; +// +// MLOperand convTranspose2d( +// MLOperand input, MLOperand filter, +// optional MLConvTranspose2dOptions options = {}); -runWebNNConformanceTests('convTranspose2d', buildConvTranspose2d); + +const convTranspose2dTests = [ + { + 'name': + 'convTranspose2d float32 4D both input and filter non-constant tensors default options', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.5872158408164978, 0.6077792048454285, 0.017289165407419205, + 0.2614607512950897 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.3292713165283203, 0.5866857171058655, 0.29701370000839233, + 0.0033378428779542446 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, {'filter': 'convTranspose2dFilter'} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [ + 0.1933533400297165, 0.5446354150772095, 0.3565753698348999, + 0.18010397255420685, 0.2787136137485504, 0.15542395412921906, + 0.0051351189613342285, 0.07771513611078262, 0.0008727149106562138 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D both input and filter constant tensors default options', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.5872158408164978, 0.6077792048454285, 0.017289165407419205, + 0.2614607512950897 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + }, + 'convTranspose2dFilter': { + 'data': [ + 0.3292713165283203, 0.5866857171058655, 0.29701370000839233, + 0.0033378428779542446 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, {'filter': 'convTranspose2dFilter'} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [ + 0.1933533400297165, 0.5446354150772095, 0.3565753698348999, + 0.18010397255420685, 0.2787136137485504, 0.15542395412921906, + 0.0051351189613342285, 0.07771513611078262, 0.0008727149106562138 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors default options', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.5872158408164978, 0.6077792048454285, 0.017289165407419205, + 0.2614607512950897 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.3292713165283203, 0.5866857171058655, 0.29701370000839233, + 0.0033378428779542446 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, {'filter': 'convTranspose2dFilter'} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [ + 0.1933533400297165, 0.5446354150772095, 0.3565753698348999, + 0.18010397255420685, 0.2787136137485504, 0.15542395412921906, + 0.0051351189613342285, 0.07771513611078262, 0.0008727149106562138 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.groups', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.8161798119544983, 0.5442776083946228, 0.7910669445991516, + 0.36564111709594727, 0.25429198145866394, 0.20815767347812653, + 0.7023073434829712, 0.5734469890594482 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.09232201427221298, 0.31896016001701355, 0.5445202589035034, + 0.6582807898521423, 0.9634373188018799, 0.012118860147893429, + 0.9230011701583862, 0.4781944155693054 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, {'options': {'groups': 2}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [ + 0.07535136491060257, 0.3105776607990265, 0.1736028790473938, + 0.5174593329429626, 1.1197212934494019, 0.4749124348163605, + 0.4307519793510437, 0.7198431491851807, 0.24069452285766602, + 0.2449943870306015, 0.20362859964370728, 0.002522633643820882, + 0.9113409519195557, 0.8747221827507019, 0.10648936033248901, + 0.6482304930686951, 0.865131676197052, 0.2742191553115845 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.groups=2 options.strides=[2, 2]', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.8161798119544983, 0.5442776083946228, 0.7910669445991516, + 0.36564111709594727, 0.25429198145866394, 0.20815767347812653, + 0.7023073434829712, 0.5734469890594482 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.09232201427221298, 0.31896016001701355, 0.5445202589035034, + 0.6582807898521423, 0.9634373188018799, 0.012118860147893429, + 0.9230011701583862, 0.4781944155693054 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'strides': [2, 2], 'groups': 2}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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.2449943870306015, 0.0030817289371043444, + 0.20054687559604645, 0.002522633643820882, 0.23471179604530334, + 0.12160100787878036, 0.19212977588176727, 0.09953983873128891, + 0.6766291260719299, 0.008511164225637913, 0.5524802207946777, + 0.00694952392950654, 0.6482304930686951, 0.3358394503593445, + 0.5292922258377075, 0.2742191553115845 + ], + 'descriptor': {'dimensions': [1, 2, 4, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.padding', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.5872158408164978, 0.6077792048454285, 0.017289165407419205, + 0.2614607512950897 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.3292713165283203, 0.5866857171058655, 0.29701370000839233, + 0.0033378428779542446 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'padding': [1, 1, 1, 1]}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [0.2787136137485504], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'convTranspose2d options.padding is the same upper padding', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, { + 'options': { + 'outputSizes': [6, 6], + 'groups': 1, + 'strides': [2, 2], + 'dilations': [1, 1], + 'padding': [0, 1, 0, 1], + 'filterLayout': 'ohwi', + 'inputLayout': 'nhwc' + } + } + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + 'data': [ + 0.5, 0.5, 0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1, 0.5, 0.5, + 0.5, 0.5, 0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1, 0.5, 0.5, + 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, + 0.5, 0.5, 0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1, 0.5, 0.5, + 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, + 0.5, 0.5, 0.5, 0.5, 1, 1, 0.5, 0.5, 1, 1, 0.5, 0.5 + ], + 'descriptor': {'dimensions': [1, 6, 6, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.strides', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, {'options': {'strides': [3, 2]}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 9, 7], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.dilations', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.3194596767425537, 0.9762163758277893, 0.4131408631801605, + 0.47982943058013916, 0.76741623878479, 0.9083173871040344, + 0.6205142140388489, 0.6580719947814941, 0.6553052067756653 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.6835425496101379, 0.9641214609146118, 0.8272836804389954, + 0.5771222710609436 + ], + 'descriptor': {'dimensions': [1, 1, 2, 2], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'dilations': [2, 2]}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.outputPadding', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'strides': [3, 2], 'outputPadding': [1, 1]}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 10, 8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.outputSizes', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'strides': [3, 2], 'outputSizes': [10, 8]}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 10, 8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.inputLayout=nchw', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'inputLayout': 'nchw'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.inputLayout=nhwc', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'inputLayout': 'nhwc'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.filterLayout=iohw', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'filterLayout': 'iohw'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.filterLayout=hwoi', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.9801966547966003, 0.6267672777175903, + 0.06169835478067398, 0.6366490125656128, 0.3220160901546478, + 0.8382642269134521, 0.7498031854629517, 0.11884837597608566, + 0.3930714726448059, 0.9921330213546753, 0.13811933994293213, + 0.3285411298274994, 0.28385090827941895, 0.8742373585700989, + 0.4235861301422119, 0.7205492258071899, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [3, 3, 2, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'filterLayout': 'hwoi'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.filterLayout=ohwi', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'filterLayout': 'ohwi'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.inputLayout=nhwc options.filterLayout=iohw', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'iohw'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.inputLayout=nhwc options.filterLayout=hwoi', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.9801966547966003, 0.6267672777175903, + 0.06169835478067398, 0.6366490125656128, 0.3220160901546478, + 0.8382642269134521, 0.7498031854629517, 0.11884837597608566, + 0.3930714726448059, 0.9921330213546753, 0.13811933994293213, + 0.3285411298274994, 0.28385090827941895, 0.8742373585700989, + 0.4235861301422119, 0.7205492258071899, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [3, 3, 2, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'hwoi'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors options.inputLayout=nhwc options.filterLayout=ohwi', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.05605664849281311, 0.7114229798316956, 0.6529743671417236, + 0.38622909784317017, 0.3870837390422821, 0.9461629390716553, + 0.09573192149400711, 0.9234652519226074, 0.636277973651886 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.8614422678947449, 0.6267672777175903, 0.6366490125656128, + 0.8382642269134521, 0.11884837597608566, 0.9921330213546753, + 0.3285411298274994, 0.8742373585700989, 0.7205492258071899, + 0.9801966547966003, 0.06169835478067398, 0.3220160901546478, + 0.7498031854629517, 0.3930714726448059, 0.13811933994293213, + 0.28385090827941895, 0.4235861301422119, 0.1448512077331543 + ], + 'descriptor': {'dimensions': [2, 3, 3, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'inputLayout': 'nhwc', 'filterLayout': 'ohwi'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'convTranspose2d float32 4D input and filter tensors options.bias', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + 0.1109575480222702, 0.8681362271308899, 0.7342095971107483, + 0.43077003955841064, 0.5981627106666565, 0.12321650236845016, + 0.1610974818468094, 0.0884026437997818, 0.29100972414016724 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.6161394715309143, 0.26224616169929504, 0.7951397895812988, + 0.8730561137199402, 0.8309102058410645, 0.854960560798645, + 0.5552039742469788, 0.840092122554779, 0.85308438539505 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'convTranspose2dBias': { + 'data': [0.451673686504364], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'bias': 'convTranspose2dBias'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'convTranspose2d float32 4D input and filter tensors, both negative input tensor and options.bias', + 'graph': { + 'inputs': { + 'convTranspose2dInput': { + 'data': [ + -0.10889056324958801, -0.29801905155181885, -0.3907785713672638, + -0.5624061226844788, -0.7322093844413757, -0.8421320915222168, + -0.30598655343055725, -0.976659893989563, -0.014158561825752258 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'} + }, + 'convTranspose2dFilter': { + 'data': [ + 0.6161394715309143, 0.26224616169929504, 0.7951397895812988, + 0.8730561137199402, 0.8309102058410645, 0.854960560798645, + 0.5552039742469788, 0.840092122554779, 0.85308438539505 + ], + 'descriptor': {'dimensions': [1, 1, 3, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'convTranspose2dBias': { + 'data': [-0.8457866311073303], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'convTranspose2d', + 'arguments': [ + {'input': 'convTranspose2dInput'}, + {'filter': 'convTranspose2dFilter'}, + {'options': {'bias': 'convTranspose2dBias'}} + ], + 'outputs': 'convTranspose2dOutput' + }], + 'expectedOutputs': { + 'convTranspose2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 5, 5], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + convTranspose2dTests.forEach((test) => { + // reuse getConv2dPrecisionTolerance method for convTranspose2d tests + webnn_conformance_test( + buildGraphAndCompute, getConv2dPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/cos.https.any.js b/webnn/conformance_tests/cos.https.any.js new file mode 100644 index 00000000000000..5ad92e7014a8b8 --- /dev/null +++ b/webnn/conformance_tests/cos.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise cos operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the cosine of the input tensor, element-wise. +// +// MLOperand cos(MLOperand input); + + +const getCosPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const cosTests = [ + { + 'name': 'cos float32 0D scalar', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [85.56369018554688], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + 'data': [-0.7380040884017944], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 1D constant tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 1D tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 2D tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 3D tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 4D tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'cos float32 5D tensor', + 'graph': { + 'inputs': { + 'cosInput': { + 'data': [ + 85.56369018554688, -45.09983825683594, -94.67750549316406, + 83.49029541015625, -31.367904663085938, 70.18042755126953, + -90.36229705810547, -83.00758361816406, 61.51649475097656, + -32.51877975463867, -48.3765869140625, -58.02735900878906, + 89.79197692871094, -84.53326416015625, -58.23252487182617, + -76.14168548583984, -59.058876037597656, 77.38546752929688, + -98.67289733886719, -63.6115608215332, 26.85724639892578, + 83.70417022705078, 76.56607055664062, -47.83436584472656 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'cos', + 'arguments': [{'input': 'cosInput'}], + 'outputs': 'cosOutput' + }], + 'expectedOutputs': { + 'cosOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + cosTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getCosPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/div.https.any.js b/webnn/conformance_tests/div.https.any.js index 65438e6c519de4..69183ee1097b1a 100644 --- a/webnn/conformance_tests/div.https.any.js +++ b/webnn/conformance_tests/div.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise div operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,528 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary division of the two input tensors. +// MLOperand div(MLOperand a, MLOperand b); -runWebNNConformanceTests('div', buildOperationWithTwoInputs); + +const getDivPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 2, float16: 2}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const divTests = [ + { + 'name': 'div float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -95.0290298461914, 62.804866790771484, -85.32865905761719, + -68.20919799804688, 79.45568084716797, -68.69049072265625, + -94.46466827392578, -10.000411033630371, 18.318864822387695, + -3.6232800483703613, -5.957828044891357, 89.49882507324219, + 94.9579086303711, -79.0005874633789, -79.87596893310547, + 74.99787139892578, 25.865373611450195, 91.5443344116211, + 81.65287017822266, 48.2148323059082, 63.370121002197266, + 10.626384735107422, 46.126625061035156, 77.22327423095703 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-41.827415466308594], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 97.32406616210938, 36.325218200683594, 26.037858963012695, + 99.47166442871094, 10.395523071289062, -30.788942337036133 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 75.08295440673828, -46.22666931152344, 15.761880874633789, + 8.9222993850708 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'div float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-41.827415466308594], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 60.42374038696289, -86.92247772216797, -19.496112823486328, + -15.150615692138672, 13.455190658569336, 45.433597564697266, + 61.082862854003906, 70.71882629394531, -31.278579711914062, + 56.08354187011719, 38.992767333984375, -3.27536940574646, + 32.28932189941406, -3.676541805267334, 88.4349136352539, + 14.369060516357422, 13.943194389343262, 16.861190795898438, + 4.816806316375732, 44.15916442871094, -13.083211898803711, + 44.56599807739258, -34.892784118652344, -74.09375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'div', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + divTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getDivPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/elementwise_unary.https.any.js b/webnn/conformance_tests/elementwise_unary.https.any.js deleted file mode 100644 index 54406005e89639..00000000000000 --- a/webnn/conformance_tests/elementwise_unary.https.any.js +++ /dev/null @@ -1,18 +0,0 @@ -// META: title=test WebNN API element-wise unary operations -// META: global=window,dedicatedworker -// META: variant=?cpu -// META: variant=?gpu -// META: variant=?npu -// META: script=../resources/utils.js -// META: timeout=long - -'use strict'; - -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-unary - -runWebNNConformanceTests( - [ - 'abs', 'ceil', 'cos', 'erf', 'exp', 'floor', 'identity', 'log', 'neg', - 'reciprocal', 'sin', 'sqrt', 'tan' - ], - buildOperationWithSingleInput); diff --git a/webnn/conformance_tests/elu.https.any.js b/webnn/conformance_tests/elu.https.any.js index b16cf04b624290..75b982944ba972 100644 --- a/webnn/conformance_tests/elu.https.any.js +++ b/webnn/conformance_tests/elu.https.any.js @@ -8,6 +8,400 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-elu +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-elu +// Calculate the exponential linear unit function (ELU) on the input tensor +// element-wise. The calculation follows the expression +// max(0, x) + alpha * (exp(min(0, x)) - 1). +// +// dictionary MLEluOptions { +// double alpha = 1; +// }; +// +// MLOperand elu(MLOperand input, optional MLEluOptions options = {}); -runWebNNConformanceTests('elu', buildOperationWithSingleInput); + +const getEluPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 18, float16: 18}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const eluTests = [ + { + 'name': 'elu float32 positive 0D scalar default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [4.721739768981934], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + 'data': [4.721739768981934], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 negative 0D scalar default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [-3.8663666248321533], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + 'data': [-0.9790657162666321], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 1D tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 2D tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 3D tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 4D tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 5D tensor default options', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': [{'input': 'eluInput'}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 4D tensor positive options.alpha', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': + [{'input': 'eluInput'}, {'options': {'alpha': 0.3607245505146506}}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'elu float32 4D tensor negative options.alpha', + 'graph': { + 'inputs': { + 'eluInput': { + 'data': [ + 4.721739768981934, 0.3768780529499054, 1.4189997911453247, + -3.8663666248321533, 1.3590080738067627, -3.8641843795776367, + 7.839725494384766, -6.69080114364624, 0.5456406474113464, + 5.776711463928223, 7.263273239135742, -7.419948101043701, + 5.665064334869385, -6.712906837463379, -3.334894895553589, + -1.2103675603866577, 7.255547046661377, 8.903468132019043, + -4.01986026763916, 7.114678382873535, -0.11212847381830215, + -3.688840866088867, 6.135150909423828, -9.895182609558105 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'elu', + 'arguments': + [{'input': 'eluInput'}, {'options': {'alpha': -3.468180406374035}}], + 'outputs': 'eluOutput' + }], + 'expectedOutputs': { + 'eluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + eluTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getEluPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/equal.https.any.js b/webnn/conformance_tests/equal.https.any.js index 4b8c6c646d8e76..c763786d4aff52 100644 --- a/webnn/conformance_tests/equal.https.any.js +++ b/webnn/conformance_tests/equal.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise equal operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,531 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-equal +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Compare if the values of the two input tensors are equal, element-wise. +// +// MLOperand equal(MLOperand a, MLOperand b); -runWebNNConformanceTests('equal', buildOperationWithTwoInputs); + +const getEqualPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const equalTests = [ + { + 'name': 'equal float32 0D scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-0.6285496950149536], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [-4.4166412353515625], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': + {'data': [0], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'equal float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.839719772338867, + 4.996258735656738, 0.9727277755737305, -6.173707485198975, + 2.80570650100708, 5.588105201721191, 7.767369747161865, + -4.308907985687256, -5.895479679107666, -8.53209114074707, + 2.80570650100708, 5.588105201721191, 0.17833954095840454, + -4.479541778564453, 0.6819732189178467, -6.6875128746032715, + 2.80570650100708, 5.588105201721191, -9.041799545288086, + -1.9728281497955322, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 broadcast 0D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [2.80570650100708], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [2.80570650100708], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -4.9622955322265625, + -2.863192081451416, -3.011512279510498, 3.6268343925476074 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, -9.041799545288086, + 3.6268343925476074 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'equal float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [2.80570650100708], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.80570650100708, 5.588105201721191, 2.855226516723633, + 4.996258735656738, 0.9727277755737305, -4.742599964141846, + 2.80570650100708, 5.588105201721191, -5.107602119445801, + 6.624142169952393, -2.3207247257232666, -7.053895950317383, + 2.80570650100708, 5.588105201721191, 4.980423927307129, + -5.440841197967529, 1.1459590196609497, 7.774532794952393, + 2.80570650100708, 5.588105201721191, -6.245251178741455, + -2.8490731716156006, -2.6951117515563965, 5.817563056945801 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'equal', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + equalTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getEqualPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/erf.https.any.js b/webnn/conformance_tests/erf.https.any.js new file mode 100644 index 00000000000000..78fc81ea74a693 --- /dev/null +++ b/webnn/conformance_tests/erf.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise erf operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the error function of the input tensor, element-wise. +// +// MLOperand erf(MLOperand input); + + +const getErfPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const erfTests = [ + { + 'name': 'erf float32 0D scalar', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [-0.004352752584964037], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + 'data': [-0.004911554511636496], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 1D constant tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 1D tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 2D tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 3D tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 4D tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'erf float32 5D tensor', + 'graph': { + 'inputs': { + 'erfInput': { + 'data': [ + -0.5883062481880188, -0.5323766469955444, 0.1279870569705963, + 0.5772181749343872, 0.904577910900116, -0.49856746196746826, + 0.9843886494636536, 0.21642258763313293, 0.25235170125961304, + -0.1491669863462448, 0.9136939644813538, -0.5736439824104309, + 0.7404468059539795, 0.5202203392982483, -0.16549505293369293, + 0.8005731701850891, 0.4001320004463196, -0.7489422559738159, + -0.8946002721786499, -0.3920256197452545, 0.6854220628738403, + -0.6744900345802307, -0.439808189868927, 0.2709762454032898 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'erf', + 'arguments': [{'input': 'erfInput'}], + 'outputs': 'erfOutput' + }], + 'expectedOutputs': { + 'erfOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + erfTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getErfPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/exp.https.any.js b/webnn/conformance_tests/exp.https.any.js new file mode 100644 index 00000000000000..9d67712ee60cdf --- /dev/null +++ b/webnn/conformance_tests/exp.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise exp operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the exponential of the input tensor, element-wise. +// +// MLOperand exp(MLOperand input); + + +const getExpPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 32, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const expTests = [ + { + 'name': 'exp float32 0D scalar', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [0.3421436548233032], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + 'data': [1.4079625606536865], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 1D constant tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 1D tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 2D tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 3D tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 4D tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'exp float32 5D tensor', + 'graph': { + 'inputs': { + 'expInput': { + 'data': [ + 0.3421436548233032, -3.310965061187744, -3.6967575550079346, + -5.105378150939941, 5.47104024887085, -0.06790750473737717, + 2.7373435497283936, -3.5470757484436035, 5.339224815368652, + -1.2636781930923462, -0.9162953495979309, -9.088432312011719, + -4.016050815582275, 4.670352935791016, 7.326992034912109, + 8.294342994689941, -7.345414161682129, -0.9275799989700317, + -1.7085379362106323, -9.73737907409668, -1.9747875928878784, + 8.203149795532227, -7.267597675323486, -3.5890684127807617 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'exp', + 'arguments': [{'input': 'expInput'}], + 'outputs': 'expOutput' + }], + 'expectedOutputs': { + 'expOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + expTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getExpPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/expand.https.any.js b/webnn/conformance_tests/expand.https.any.js index 1535bb76a90275..6f94795370fab1 100644 --- a/webnn/conformance_tests/expand.https.any.js +++ b/webnn/conformance_tests/expand.https.any.js @@ -8,7 +8,724 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-expand +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-expand +// Expand any dimension of size 1 of the input tensor to a larger size according +// to the new shape. +// +// MLOperand expand( +// MLOperand input, sequence<[EnforceRange] unsigned long> newShape); -// Reuse buildReshape method -runWebNNConformanceTests('expand', buildReshape); + +const getExpandPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const expandTests = [ + { + 'name': 'expand float32 0D scalar to 1D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [24]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 0D scalar to 2D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 0D scalar to 3D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 4]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 0D scalar to 4D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 0D scalar to 5D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 2, 3, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D constant tensor to 1D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [24]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D tensor to 1D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [24]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D tensor to 2D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D tensor to 3D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 4]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D tensor to 4D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 1D tensor to 5D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 2, 3, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 2D (1st dimension)', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [ + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375 + ], + 'descriptor': {'dimensions': [1, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 2D (2nd dimension)', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [ + 4.965915679931641, 66.14382934570312, 75.28175354003906, + 49.998130798339844 + ], + 'descriptor': {'dimensions': [4, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 4.965915679931641, 4.965915679931641, 4.965915679931641, + 4.965915679931641, 4.965915679931641, 4.965915679931641, + 66.14382934570312, 66.14382934570312, 66.14382934570312, + 66.14382934570312, 66.14382934570312, 66.14382934570312, + 75.28175354003906, 75.28175354003906, 75.28175354003906, + 75.28175354003906, 75.28175354003906, 75.28175354003906, + 49.998130798339844, 49.998130798339844, 49.998130798339844, + 49.998130798339844, 49.998130798339844, 49.998130798339844 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 2D (all dimensions)', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [4, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 3D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [ + 4.965915679931641, 66.14382934570312, 75.28175354003906, + 49.998130798339844 + ], + 'descriptor': {'dimensions': [4, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 4, 3]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 4.965915679931641, 4.965915679931641, 4.965915679931641, + 66.14382934570312, 66.14382934570312, 66.14382934570312, + 75.28175354003906, 75.28175354003906, 75.28175354003906, + 49.998130798339844, 49.998130798339844, 49.998130798339844, + 4.965915679931641, 4.965915679931641, 4.965915679931641, + 66.14382934570312, 66.14382934570312, 66.14382934570312, + 75.28175354003906, 75.28175354003906, 75.28175354003906, + 49.998130798339844, 49.998130798339844, 49.998130798339844 + ], + 'descriptor': {'dimensions': [2, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 4D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [ + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375 + ], + 'descriptor': {'dimensions': [1, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 2, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375, + 10.898762702941895, -29.391416549682617, -73.74250793457031, + 22.456905364990234, -97.5792465209961, -76.95013427734375 + ], + 'descriptor': {'dimensions': [2, 1, 2, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 2D tensor to 5D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [-6.461850643157959], + 'descriptor': {'dimensions': [1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 3, 2, 2]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959, + -6.461850643157959, -6.461850643157959, -6.461850643157959 + ], + 'descriptor': {'dimensions': [2, 1, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 3D tensor to 3D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [21.694129943847656, -72.82571411132812], + 'descriptor': {'dimensions': [1, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 6]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 21.694129943847656, 21.694129943847656, 21.694129943847656, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + -72.82571411132812, -72.82571411132812, -72.82571411132812 + ], + 'descriptor': {'dimensions': [2, 2, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 3D tensor to 4D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [21.694129943847656, -72.82571411132812], + 'descriptor': {'dimensions': [1, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 2, 3]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 3D tensor to 5D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [21.694129943847656, -72.82571411132812], + 'descriptor': {'dimensions': [1, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 1, 2, 2, 3]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812, + 21.694129943847656, 21.694129943847656, 21.694129943847656, + -72.82571411132812, -72.82571411132812, -72.82571411132812 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 4D tensor to 4D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [12.799123764038086, -26.550199508666992], + 'descriptor': {'dimensions': [2, 1, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 3, 2, 2]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 12.799123764038086, 12.799123764038086, 12.799123764038086, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + -26.550199508666992, -26.550199508666992, -26.550199508666992 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'expand float32 4D tensor to 5D', + 'graph': { + 'inputs': { + 'expandInput': { + 'data': [12.799123764038086, -26.550199508666992], + 'descriptor': {'dimensions': [2, 1, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'expand', + 'arguments': [{'input': 'expandInput'}, {'newShape': [2, 2, 3, 1, 2]}], + 'outputs': 'expandOutput' + }], + 'expectedOutputs': { + 'expandOutput': { + 'data': [ + 12.799123764038086, 12.799123764038086, 12.799123764038086, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + 12.799123764038086, 12.799123764038086, 12.799123764038086, + -26.550199508666992, -26.550199508666992, -26.550199508666992, + -26.550199508666992, -26.550199508666992, -26.550199508666992 + ], + 'descriptor': {'dimensions': [2, 2, 3, 1, 2], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + expandTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getExpandPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/floor.https.any.js b/webnn/conformance_tests/floor.https.any.js new file mode 100644 index 00000000000000..4cca407cd4c3df --- /dev/null +++ b/webnn/conformance_tests/floor.https.any.js @@ -0,0 +1,261 @@ +// META: title=test WebNN API element-wise floor operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the floor of the input tensor, element-wise. +// +// MLOperand floor(MLOperand input); + + +const getFloorPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const floorTests = [ + { + 'name': 'floor float32 0D scalar', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [89.69458770751953], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + 'data': [89], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 1D constant tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 1D tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 2D tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 3D tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 4D tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'floor float32 5D tensor', + 'graph': { + 'inputs': { + 'floorInput': { + 'data': [ + 89.69458770751953, -79.67150115966797, -66.80949401855469, + -71.88439178466797, 86.33935546875, 6.823808670043945, + 24.908447265625, 0.9734055399894714, 19.948184967041016, + 0.8437776565551758, -24.752939224243164, 77.76482391357422, + -33.644466400146484, 80.7762451171875, 44.47844314575195, + -37.65005874633789, -83.78780364990234, 65.840087890625, + -39.83677673339844, 32.5257568359375, -21.213542938232422, + -80.30911254882812, 16.674850463867188, -72.88893127441406 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'floor', + 'arguments': [{'input': 'floorInput'}], + 'outputs': 'floorOutput' + }], + 'expectedOutputs': { + 'floorOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + floorTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getFloorPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/gather.https.any.js b/webnn/conformance_tests/gather.https.any.js index 68d33bbf748f68..3befa3818fcef7 100644 --- a/webnn/conformance_tests/gather.https.any.js +++ b/webnn/conformance_tests/gather.https.any.js @@ -8,6 +8,968 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gather +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-gather +// Gather values of the input tensor along an axis according to the indices. +// +// dictionary MLGatherOptions { +// [EnforceRange] unsigned long axis = 0; +// }; +// +// MLOperand gather( +// MLOperand input, MLOperand indices, +// optional MLGatherOptions options = {}); -runWebNNConformanceTests('gather', buildOperationWithTwoInputs); + +const getGatherPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const gatherTests = [ + { + 'name': + 'gather float32 1D tensor and uint32 0D scalar indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [4], + 'descriptor': {'dimensions': [], 'dataType': 'uint32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [89.0337142944336], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gather float32 1D tensor and int32 0D scalar indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [4], + 'descriptor': {'dimensions': [], 'dataType': 'int32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [89.0337142944336], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gather float32 1D tensor and int64 0D scalar indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [0], + 'descriptor': {'dimensions': [], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [-66.05901336669922], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 1D tensor and int64 1D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [16, 20, 6, 11, 17, 19, 13, 17], + 'descriptor': {'dimensions': [8], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [ + 10.829925537109375, 0.9129875898361206, 43.84803771972656, + -50.42131042480469, -19.693084716796875, 43.11057662963867, + 55.620765686035156, -19.693084716796875 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 1D tensor and int64 2D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [14, 9, 21, 17], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [ + 44.92119598388672, 41.94132614135742, -7.699817180633545, + -19.693084716796875 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 1D tensor and int64 3D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': + [17, 19, 14, 16, 13, 0, 5, 15, 18, 18, 6, 20, 7, 22, 5, 1, 4, 19], + 'descriptor': {'dimensions': [2, 3, 3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 1D tensor and int64 4D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [18, 18, 22, 11, 8, 15, 12, 11, 7, 13, 7, 7], + 'descriptor': {'dimensions': [1, 2, 2, 3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 2D tensor and 0D scalar indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [11], + 'descriptor': {'dimensions': [], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [25.76774024963379, 73.60064697265625], + 'descriptor': {'dimensions': [2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 2D tensor and 1D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [1, 10, 9, 0, 3, 5, 3, 8], + 'descriptor': {'dimensions': [8], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [8, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 2D tensor and 2D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [4, 8, 9, 10], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [ + 51.79948425292969, 41.94132614135742, 10.829925537109375, + -19.693084716796875, -37.696800231933594, 43.11057662963867, + 0.9129875898361206, -7.699817180633545 + ], + 'descriptor': {'dimensions': [2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 2D tensor and 3D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [8, 2, 2, 3, 4, 1, 2, 2, 7, 11, 4, 11, 6, 6, 7, 3, 11, 10], + 'descriptor': {'dimensions': [2, 3, 3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 2D tensor and 4D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [12, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [6, 9, 7, 3, 4, 7, 4, 3, 7, 7, 6, 0], + 'descriptor': {'dimensions': [1, 2, 2, 3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 2, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 3D tensor and 2D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [2, 1, 1, 1], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 4, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 4D tensor and 2D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [8, 1, 1, 3], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [0, 0, 7, 4], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 5D tensor and 1D indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 1, 1, 3], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [3, 2, 2], + 'descriptor': {'dimensions': [3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 1, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 3D tensor and 1D indices options.axis=1', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [1, 1, 2], + 'descriptor': {'dimensions': [3], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [ + {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, + {'options': {'axis': 1}} + ], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 3D tensor and 2D indices options.axis=2', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [0, 0, 0, 1], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [ + {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, + {'options': {'axis': 2}} + ], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 4D tensor and 2D indices explict options.axis=0', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [8, 1, 1, 3], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [0, 0, 7, 4], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [ + {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, + {'options': {'axis': 0}} + ], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gather float32 5D tensor and 0D scalar indices options.axis=4', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 1, 1, 3], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [1], + 'descriptor': {'dimensions': [], 'dataType': 'int64'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [ + {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, + {'options': {'axis': 4}} + ], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [ + -68.9197006225586, 89.0337142944336, 48.81806945800781, + -1.1303654909133911, 55.620765686035156, 10.829925537109375, + 43.11057662963867, 25.76774024963379 + ], + 'descriptor': {'dimensions': [4, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gather float32 2D tensor and int32 0D negative indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [-2], + 'descriptor': {'dimensions': [], 'dataType': 'int32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gather float32 2D tensor and int32 0D out-of-bound positive indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [10], + 'descriptor': {'dimensions': [], 'dataType': 'int32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + 'data': [ + 90.2870101928711, 55.620765686035156, 44.92119598388672, + 56.828636169433594, 10.829925537109375, -19.693084716796875, + -37.696800231933594, 43.11057662963867, 0.9129875898361206, + -7.699817180633545, 25.76774024963379, 73.60064697265625 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gather float32 2D tensor and int32 0D out-of-bound negative indices default options', + 'graph': { + 'inputs': { + 'gatherInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'} + }, + 'gatherIndices': { + 'data': [-10], + 'descriptor': {'dimensions': [], 'dataType': 'int32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gather', + 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], + 'outputs': 'gatherOutput' + }], + 'expectedOutputs': { + 'gatherOutput': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + gatherTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getGatherPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/gelu.https.any.js b/webnn/conformance_tests/gelu.https.any.js index 67287c3ad3f198..446c5bc4effb97 100644 --- a/webnn/conformance_tests/gelu.https.any.js +++ b/webnn/conformance_tests/gelu.https.any.js @@ -8,6 +8,513 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gelu +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-gelu-method +// Compute the gaussian error linear unit function (GELU) of the input tensor. +// The calculation follows the expression 0.5 * x * (1 + erf(x / sqrt(2))). +// +// MLOperand gelu(MLOperand input); -runWebNNConformanceTests('gelu', buildOperationWithSingleInput); + +const getGeluPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 18, float16: 18}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const geluTests = [ + { + 'name': 'gelu float32 0D scalar', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [-0.044885843992233276], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [-0.021639423444867134], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 0D scalar', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [-0.044891357421875], + 'descriptor': {'dimensions': [], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [-0.021636962890625], + 'descriptor': {'dimensions': [], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'gelu float32 1D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float32 1D constant tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 1D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.87841796875, -0.0970458984375, 0.13671875, + 0.464111328125, -0.266357421875, -0.8251953125, + 0.85302734375, 0.384521484375, 0.67724609375, + -0.481201171875, 0.29833984375, 0.677734375, + -0.5263671875, 0.349853515625, -0.129150390625, + 0.58544921875, -0.89501953125, 0.0283050537109375, + -0.0989990234375, -0.8837890625, -0.59619140625, + 0.318603515625, 0.4794921875, -0.06488037109375 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.71142578125, -0.044769287109375, 0.0758056640625, + 0.31494140625, -0.105224609375, -0.1688232421875, + 0.68505859375, 0.2498779296875, 0.50830078125, + -0.151611328125, 0.1842041015625, 0.5087890625, + -0.1575927734375, 0.2227783203125, -0.057952880859375, + 0.422119140625, -0.1658935546875, 0.01447296142578125, + -0.04559326171875, -0.16650390625, -0.164306640625, + 0.1990966796875, 0.328125, -0.03076171875 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'gelu float32 2D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 2D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.87841796875, -0.0970458984375, 0.13671875, + 0.464111328125, -0.266357421875, -0.8251953125, + 0.85302734375, 0.384521484375, 0.67724609375, + -0.481201171875, 0.29833984375, 0.677734375, + -0.5263671875, 0.349853515625, -0.129150390625, + 0.58544921875, -0.89501953125, 0.0283050537109375, + -0.0989990234375, -0.8837890625, -0.59619140625, + 0.318603515625, 0.4794921875, -0.06488037109375 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.71142578125, -0.044769287109375, 0.0758056640625, + 0.31494140625, -0.105224609375, -0.1688232421875, + 0.68505859375, 0.2498779296875, 0.50830078125, + -0.151611328125, 0.1842041015625, 0.5087890625, + -0.1575927734375, 0.2227783203125, -0.057952880859375, + 0.422119140625, -0.1658935546875, 0.01447296142578125, + -0.04559326171875, -0.16650390625, -0.164306640625, + 0.1990966796875, 0.328125, -0.03076171875 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'gelu float32 3D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 3D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.87841796875, -0.0970458984375, 0.13671875, + 0.464111328125, -0.266357421875, -0.8251953125, + 0.85302734375, 0.384521484375, 0.67724609375, + -0.481201171875, 0.29833984375, 0.677734375, + -0.5263671875, 0.349853515625, -0.129150390625, + 0.58544921875, -0.89501953125, 0.0283050537109375, + -0.0989990234375, -0.8837890625, -0.59619140625, + 0.318603515625, 0.4794921875, -0.06488037109375 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.71142578125, -0.044769287109375, 0.0758056640625, + 0.31494140625, -0.105224609375, -0.1688232421875, + 0.68505859375, 0.2498779296875, 0.50830078125, + -0.151611328125, 0.1842041015625, 0.5087890625, + -0.1575927734375, 0.2227783203125, -0.057952880859375, + 0.422119140625, -0.1658935546875, 0.01447296142578125, + -0.04559326171875, -0.16650390625, -0.164306640625, + 0.1990966796875, 0.328125, -0.03076171875 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'gelu float32 4D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 4D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.87841796875, -0.0970458984375, 0.13671875, + 0.464111328125, -0.266357421875, -0.8251953125, + 0.85302734375, 0.384521484375, 0.67724609375, + -0.481201171875, 0.29833984375, 0.677734375, + -0.5263671875, 0.349853515625, -0.129150390625, + 0.58544921875, -0.89501953125, 0.0283050537109375, + -0.0989990234375, -0.8837890625, -0.59619140625, + 0.318603515625, 0.4794921875, -0.06488037109375 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.71142578125, -0.044769287109375, 0.0758056640625, + 0.31494140625, -0.105224609375, -0.1688232421875, + 0.68505859375, 0.2498779296875, 0.50830078125, + -0.151611328125, 0.1842041015625, 0.5087890625, + -0.1575927734375, 0.2227783203125, -0.057952880859375, + 0.422119140625, -0.1658935546875, 0.01447296142578125, + -0.04559326171875, -0.16650390625, -0.164306640625, + 0.1990966796875, 0.328125, -0.03076171875 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float16'} + } + } + } + }, + { + 'name': 'gelu float32 5D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.878292441368103, -0.09706497937440872, 0.1367187649011612, + 0.46406492590904236, -0.26635801792144775, -0.8252315521240234, + 0.8530909419059753, 0.3846154808998108, 0.6772316694259644, + -0.4811072051525116, 0.2983909249305725, 0.6777864098548889, + -0.526228129863739, 0.3497541546821594, -0.12918996810913086, + 0.5853934288024902, -0.8950720429420471, 0.028302494436502457, + -0.09901237487792969, -0.8838679790496826, -0.596120297908783, + 0.31863871216773987, 0.4794037640094757, -0.06489315629005432 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.7115113139152527, -0.0447796992957592, 0.07579325884580612, + 0.3149605691432953, -0.10520657151937485, -0.16885890066623688, + 0.6851989030838013, 0.24989959597587585, 0.508513331413269, + -0.1516546905040741, 0.18419598042964935, 0.509049117565155, + -0.15753419697284698, 0.22270187735557556, -0.05795508995652199, + 0.42198580503463745, -0.1659233123064041, 0.014470770955085754, + -0.04560155048966408, -0.1665063202381134, -0.1642593890428543, + 0.19914908707141876, 0.3279957175254822, -0.030767757445573807 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gelu float16 5D tensor', + 'graph': { + 'inputs': { + 'geluInput': { + 'data': [ + 0.87841796875, -0.0970458984375, 0.13671875, + 0.464111328125, -0.266357421875, -0.8251953125, + 0.85302734375, 0.384521484375, 0.67724609375, + -0.481201171875, 0.29833984375, 0.677734375, + -0.5263671875, 0.349853515625, -0.129150390625, + 0.58544921875, -0.89501953125, 0.0283050537109375, + -0.0989990234375, -0.8837890625, -0.59619140625, + 0.318603515625, 0.4794921875, -0.06488037109375 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float16'} + } + }, + 'operators': [{ + 'name': 'gelu', + 'arguments': [{'input': 'geluInput'}], + 'outputs': 'geluOutput' + }], + 'expectedOutputs': { + 'geluOutput': { + 'data': [ + 0.71142578125, -0.044769287109375, 0.0758056640625, + 0.31494140625, -0.105224609375, -0.1688232421875, + 0.68505859375, 0.2498779296875, 0.50830078125, + -0.151611328125, 0.1842041015625, 0.5087890625, + -0.1575927734375, 0.2227783203125, -0.057952880859375, + 0.422119140625, -0.1658935546875, 0.01447296142578125, + -0.04559326171875, -0.16650390625, -0.164306640625, + 0.1990966796875, 0.328125, -0.03076171875 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float16'} + } + } + } + } +]; + +if (navigator.ml) { + geluTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getGeluPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/gemm.https.any.js b/webnn/conformance_tests/gemm.https.any.js index 0af471753e049f..70b2ecb5e1e726 100644 --- a/webnn/conformance_tests/gemm.https.any.js +++ b/webnn/conformance_tests/gemm.https.any.js @@ -8,6 +8,1295 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-gemm +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-gemm +// Calculate the general matrix multiplication of the Basic Linear Algebra +// Subprograms. The calculation follows the expression alpha * A * B + beta * C +// +// dictionary MLGemmOptions { +// MLOperand c; +// double alpha = 1.0; +// double beta = 1.0; +// boolean aTranspose = false; +// boolean bTranspose = false; +// }; +// +// MLOperand gemm( +// MLOperand a, MLOperand b, optional MLGemmOptions options = {}); -runWebNNConformanceTests('gemm', buildGemm); + +const getGemmPrecisionTolerance = (graphResources) => { + // 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 args = graphResources.operators[0].arguments; + const shapeA = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const options = + args.length === 3 ? {...args[2][Object.keys(args[2])[0]]} : {}; + 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++; + } + + const toleranceValueDict = {float32: tolerance, float16: tolerance}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const gemmTests = [ + { + 'name': 'gemm two float32 2D tensors (b is non-constant) default options', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors default options', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D constant tensors options.c', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.c', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors broadcast options.c [1, 5] => [3, 5]', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 85.90813446044922, 39.3753547668457, 50.942604064941406, + 31.87430763244629, 31.210525512695312 + ], + 'descriptor': {'dimensions': [1, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors broadcast options.c [3, 1] => [3, 5]', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [6.20251989364624, 81.40641784667969, 73.00516510009766], + 'descriptor': {'dimensions': [3, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors broadcast options.c [1, 1] => [3, 5]', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [18.78192901611328], + 'descriptor': {'dimensions': [1, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors broadcast options.c [5] => [3, 5]', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 85.90813446044922, 39.3753547668457, 50.942604064941406, + 31.87430763244629, 31.210525512695312 + ], + 'descriptor': {'dimensions': [5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors broadcast options.c [1] => [3, 5]', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [18.78192901611328], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors scalar options.c', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [18.78192901611328], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': + [{'a': 'inputA'}, {'b': 'inputB'}, {'options': {'c': 'inputC'}}], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.alpha', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'alpha': 74.43204170482103}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.beta', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'beta': 62.01828598608989}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.c and options.beta', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'c': 'inputC', 'beta': 62.01828598608989}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.aTranspose being true', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 18.9648494720459, 50.51683807373047, + 90.51641082763672, 43.89479446411133, 40.45679473876953, + 59.638519287109375, 98.89488220214844, 50.76741409301758, + 36.271873474121094, 91.46013641357422, 9.336554527282715 + ], + 'descriptor': {'dimensions': [4, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, {'options': {'aTranspose': true}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gemm two float32 2D tensors options.aTranspose being explicit false', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, {'options': {'aTranspose': false}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors options.bTranspose being true', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 0.0037256532814353704, 75.74880981445312, + 42.90679168701172, 66.6923828125, 16.4991455078125, + 96.60688018798828, 34.08055114746094, 63.29909896850586, + 3.036668062210083, 99.10041809082031, 87.37654876708984, + 10.629964828491211, 93.14022064208984, 23.2437744140625, + 92.34209442138672, 61.32737731933594, 70.08265686035156, + 86.11856842041016, 60.32209014892578 + ], + 'descriptor': {'dimensions': [5, 4], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, {'options': {'bTranspose': true}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gemm two float32 2D tensors options.bTranspose being explicit false', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, {'options': {'bTranspose': false}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm two float32 2D tensors all options', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 18.9648494720459, 50.51683807373047, + 90.51641082763672, 43.89479446411133, 40.45679473876953, + 59.638519287109375, 98.89488220214844, 50.76741409301758, + 36.271873474121094, 91.46013641357422, 9.336554527282715 + ], + 'descriptor': {'dimensions': [4, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 0.0037256532814353704, 75.74880981445312, + 42.90679168701172, 66.6923828125, 16.4991455078125, + 96.60688018798828, 34.08055114746094, 63.29909896850586, + 3.036668062210083, 99.10041809082031, 87.37654876708984, + 10.629964828491211, 93.14022064208984, 23.2437744140625, + 92.34209442138672, 61.32737731933594, 70.08265686035156, + 86.11856842041016, 60.32209014892578 + ], + 'descriptor': {'dimensions': [5, 4], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, { + 'options': { + 'c': 'inputC', + 'alpha': 74.43204170482103, + 'beta': 62.01828598608989, + 'aTranspose': true, + 'bTranspose': true + } + } + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm both negative options.alpha and 1st float32 input tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -87.94973754882812, -14.765121459960938, -80.86310577392578, + -59.27638244628906, -28.74825096130371, -9.038779258728027, + -76.046630859375, -83.94807434082031, -95.02689361572266, + -47.89733123779297, -69.0116195678711, -86.66899108886719 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'c': 'inputC', 'alpha': -22.611149749186296}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm both negative options.alpha and 2nd float32 input tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -64.35197448730469, -87.64981079101562, -96.04495239257812, + -31.07155990600586, -6.548067092895508, -64.64146423339844, + -14.02061653137207, -88.93306732177734, -24.179410934448242, + -97.31866455078125, -93.4608154296875, -39.490394592285156, + -94.37982177734375, -75.83335876464844, -11.403324127197266, + -26.2825927734375, -56.237979888916016, -46.47404861450195, + -89.20684051513672, -53.495323181152344 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'c': 'inputC', 'alpha': -22.611149749186296}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gemm both negative options.beta and 3rd float32 input tensor (options.c)', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + -42.662681579589844, -93.6637954711914, -40.708492279052734, + -45.060977935791016, -87.90338897705078, -71.1618881225586, + -85.56422424316406, -10.049134254455566, -46.105403900146484, + -66.76168060302734, -25.392492294311523, -65.62987518310547, + -40.50155258178711, -81.5303955078125, -41.39629364013672 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'c': 'inputC', 'beta': -11.68521964935509}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'gemm both negative options.alpha and options.beta', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + 82.77201843261719, 91.38520812988281, 12.651897430419922, + 20.12200355529785, 68.51224517822266, 35.202415466308594, + 13.33466625213623, 50.78546905517578, 88.61195373535156, + 30.577470779418945, 69.47061920166016, 7.166217803955078, + 28.337108612060547, 90.69412231445312, 71.23025512695312 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, { + 'options': { + 'c': 'inputC', + 'alpha': -22.611149749186296, + 'beta': -11.68521964935509 + } + } + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'gemm both negative options.alpha and 3rd float32 input tensor (options.c)', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 82.98884582519531, 90.51641082763672, 59.638519287109375, + 36.271873474121094, 18.9648494720459, 43.89479446411133, + 98.89488220214844, 91.46013641357422, 50.51683807373047, + 40.45679473876953, 50.76741409301758, 9.336554527282715 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 25.14739227294922, 66.6923828125, 63.29909896850586, + 10.629964828491211, 61.32737731933594, 0.0037256532814353704, + 16.4991455078125, 3.036668062210083, 93.14022064208984, + 70.08265686035156, 75.74880981445312, 96.60688018798828, + 99.10041809082031, 23.2437744140625, 86.11856842041016, + 42.90679168701172, 34.08055114746094, 87.37654876708984, + 92.34209442138672, 60.32209014892578 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'}, + 'constant': true + }, + 'inputC': { + 'data': [ + -42.662681579589844, -93.6637954711914, -40.708492279052734, + -45.060977935791016, -87.90338897705078, -71.1618881225586, + -85.56422424316406, -10.049134254455566, -46.105403900146484, + -66.76168060302734, -25.392492294311523, -65.62987518310547, + -40.50155258178711, -81.5303955078125, -41.39629364013672 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'gemm', + 'arguments': [ + {'a': 'inputA'}, {'b': 'inputB'}, + {'options': {'c': 'inputC', 'alpha': -22.611149749186296}} + ], + 'outputs': 'gemmOutput' + }], + 'expectedOutputs': { + 'gemmOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + gemmTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getGemmPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/greater.https.any.js b/webnn/conformance_tests/greater.https.any.js index 8d642413e2952c..e9a63b1682a69c 100644 --- a/webnn/conformance_tests/greater.https.any.js +++ b/webnn/conformance_tests/greater.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise greater operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,531 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-greater +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Compare if the values of the first input tensor is greater, element-wise. +// +// MLOperand greater(MLOperand a, MLOperand b); -runWebNNConformanceTests('greater', buildOperationWithTwoInputs); + +const getGreaterPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const greaterTests = [ + { + 'name': 'greater float32 0D scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [3.6851015090942383], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [1.723199725151062], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': + {'data': [1], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'greater float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -6.155234336853027, -4.023341178894043, 5.9525980949401855, + 2.306623697280884, -2.7692291736602783, -0.9711201190948486, + 1.222206711769104, 4.590261459350586, 9.101232528686523, + -4.997007846832275, -4.80729341506958, 8.919360160827637, + 0.9005027413368225, -2.8414556980133057, -2.8280413150787354, + 8.47984504699707, -7.84067964553833, 9.213960647583008, + 4.982365131378174, -2.507319211959839, -4.518013954162598, + 8.351094245910645, -6.161073207855225, 0.7364829182624817 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 broadcast 0D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [6.2216410636901855], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [6.2216410636901855], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -2.684664487838745, 6.170023441314697, 9.487744331359863, + -2.5556411743164062, -2.0436434745788574, 8.533930778503418 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.099076271057129, -7.781408309936523, 8.782817840576172, + -8.948624610900879 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greater float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [6.2216410636901855], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -5.394711494445801, -7.189248561859131, -3.1081764698028564, + 4.977657318115234, 5.111654281616211, -1.5386580228805542, + 1.414366364479065, -0.9362112283706665, -6.029961585998535, + -3.0134198665618896, 0.170855313539505, 7.395327091217041, + 7.178691864013672, -4.826237678527832, -2.020440101623535, + -3.267888069152832, 8.944384574890137, -5.932100772857666, + 0.7069857120513916, 2.7764203548431396, 0.978833794593811, + -6.254901885986328, 4.409034729003906, -6.775286674499512 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greater', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + greaterTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getGreaterPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/greater_or_equal.https.any.js b/webnn/conformance_tests/greater_or_equal.https.any.js index 676116aff6674b..2f2f572eba3be7 100644 --- a/webnn/conformance_tests/greater_or_equal.https.any.js +++ b/webnn/conformance_tests/greater_or_equal.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise greaterOrEqual operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,532 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-greaterorequal +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Compare if the values of the first input tensor is greater or equal, +// element-wise. +// +// MLOperand greaterOrEqual(MLOperand a, MLOperand b); -runWebNNConformanceTests('greaterOrEqual', buildOperationWithTwoInputs); + +const getGreaterOrEqualPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const greaterOrEqualTests = [ + { + 'name': 'greaterOrEqual float32 0D scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [0.2829853594303131], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [6.156983375549316], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': + {'data': [0], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'greaterOrEqual float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -7.028095245361328, 1.9109991788864136, 3.5765292644500732, + 1.7167965173721313, 2.846137523651123, -2.311763048171997, + -6.086130142211914, -3.437926769256592, -3.476442813873291, + -2.1946563720703125, 2.9962267875671387, -5.540947914123535, + 5.098470211029053, 6.775498867034912, 2.4505412578582764, + 5.210598945617676, -9.710094451904297, -2.4130282402038574, + 8.678308486938477, -9.449530601501465, 0.7702168822288513, + -1.5186073780059814, -9.153943061828613, -4.991735935211182 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 broadcast 0D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-1.0187573432922363], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-1.0187573432922363], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -4.19451379776001, 3.8917839527130127, -3.5139973163604736, + 6.279316425323486, 0.001788170775398612, -0.7928582429885864 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -3.2823047637939453, -1.3975636959075928, 0.49053606390953064, + -6.882648944854736 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'greaterOrEqual float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-1.0187573432922363], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.049108505249023, -5.522611141204834, -2.097508192062378, + -7.455326557159424, -5.450376510620117, 9.802918434143066, + -3.604517936706543, 4.088084697723389, -5.068355083465576, + 1.5821936130523682, 5.675583839416504, -4.34159517288208, + 1.694622278213501, 2.926734685897827, -7.00007438659668, + -2.5270822048187256, 1.4437267780303955, 7.862768650054932, + 5.782289028167725, 1.8712012767791748, -0.5233999490737915, + 0.43433287739753723, 8.93836498260498, 1.6568396091461182 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'greaterOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + greaterOrEqualTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getGreaterOrEqualPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/hard_sigmoid.https.any.js b/webnn/conformance_tests/hard_sigmoid.https.any.js index cfc726a57be26b..a5c4d3d6dee97d 100644 --- a/webnn/conformance_tests/hard_sigmoid.https.any.js +++ b/webnn/conformance_tests/hard_sigmoid.https.any.js @@ -8,6 +8,678 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-sigmoid +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-hard-sigmoid +// Calculate the non-smooth hard sigmoid function on the input tensor, used +// instead of the sigmoid function for faster computation. +// +// dictionary MLHardSigmoidOptions { +// double alpha = 0.2; +// double beta = 0.5; +// }; +// +// MLOperand hardSigmoid( +// MLOperand input, optional MLHardSigmoidOptions options = {}); -runWebNNConformanceTests('hardSigmoid', buildOperationWithSingleInput); + +const getHardSigmoidPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 2, float16: 2}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const hardSigmoidTests = [ + { + 'name': 'hardSigmoid float32 positive 1D constant tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSigmoid float32 positive 1D tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSigmoid float32 positive 2D tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSigmoid float32 positive 3D tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSigmoid float32 positive 4D tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSigmoid float32 positive 5D tensor default options', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [{'input': 'hardSigmoidInput'}], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 positive 4D tensor specified positive options.alpha default options.beta', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, + {'options': {'alpha': 0.7854232544278235}} + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 negative 4D tensor specified negative options.alpha default options.beta', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, + -0.4231015741825104, -0.6643692851066589, -0.950294017791748, + -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, + -0.5322551727294922, -0.684307873249054, -0.4662107527256012, + -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, + -0.663689911365509, -0.5547611713409424, -0.554258406162262, + -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, + -0.8455570340156555, -0.555302083492279, -0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, + {'options': {'alpha': -0.7854232544278235}} + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 positive 4D tensor specified positive options.beta default options.alpha', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, + {'options': {'beta': 0.4361860418530341}} + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 negative 4D tensor specified negative options.beta default options.alpha', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, + -0.4231015741825104, -0.6643692851066589, -0.950294017791748, + -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, + -0.5322551727294922, -0.684307873249054, -0.4662107527256012, + -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, + -0.663689911365509, -0.5547611713409424, -0.554258406162262, + -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, + -0.8455570340156555, -0.555302083492279, -0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, + {'options': {'beta': -0.436186041853034}} + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 positive 4D tensor specified all options (positive options.alpha and positive options.beta)', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, + {'options': {'alpha': 0.7854232544278235, 'beta': 0.4361860418530341}} + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 positive 4D tensor specified all options (negative options.alpha and negative options.beta)', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, + 0.4231015741825104, 0.6643692851066589, 0.950294017791748, + 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, + 0.5322551727294922, 0.684307873249054, 0.4662107527256012, + 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, + 0.663689911365509, 0.5547611713409424, 0.554258406162262, + 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, + 0.8455570340156555, 0.555302083492279, 0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, { + 'options': + {'alpha': -0.7854232544278235, 'beta': -0.4361860418530341} + } + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 negative 4D tensor all options (positive options.alpha and negative options.beta)', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, + -0.4231015741825104, -0.6643692851066589, -0.950294017791748, + -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, + -0.5322551727294922, -0.684307873249054, -0.4662107527256012, + -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, + -0.663689911365509, -0.5547611713409424, -0.554258406162262, + -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, + -0.8455570340156555, -0.555302083492279, -0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, { + 'options': + {'alpha': 0.7854232544278235, 'beta': -0.4361860418530341} + } + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'hardSigmoid float32 negative 4D tensor specified all options (negative options.alpha and positive options.beta)', + 'graph': { + 'inputs': { + 'hardSigmoidInput': { + 'data': [ + -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, + -0.4231015741825104, -0.6643692851066589, -0.950294017791748, + -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, + -0.5322551727294922, -0.684307873249054, -0.4662107527256012, + -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, + -0.663689911365509, -0.5547611713409424, -0.554258406162262, + -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, + -0.8455570340156555, -0.555302083492279, -0.5603444576263428 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSigmoid', + 'arguments': [ + {'input': 'hardSigmoidInput'}, { + 'options': + {'alpha': -0.7854232544278235, 'beta': 0.4361860418530341} + } + ], + 'outputs': 'hardSigmoidOutput' + }], + 'expectedOutputs': { + 'hardSigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + hardSigmoidTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getHardSigmoidPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/hard_swish.https.any.js b/webnn/conformance_tests/hard_swish.https.any.js index 229e1b561083b8..5459e5662e4f98 100644 --- a/webnn/conformance_tests/hard_swish.https.any.js +++ b/webnn/conformance_tests/hard_swish.https.any.js @@ -8,6 +8,365 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-hard-swish +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-hard-swish +// Computes the nonlinear function y = x * max(0, min(6, (x + 3))) / 6 that is +// introduced by MobileNetV3 on the input tensor element-wise. +// +// MLOperand hardSwish(MLOperand input); -runWebNNConformanceTests('hardSwish', buildOperationWithSingleInput); + +const getHardSwishPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 4, float16: 4}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const hardSwishTests = [ + { + 'name': 'hardSwish float32 1D constant tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSwish float32 1D tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSwish float32 2D tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSwish float32 3D tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSwish float32 4D tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'hardSwish float32 5D tensor', + 'graph': { + 'inputs': { + 'hardSwishInput': { + 'data': [ + 0.7341583371162415, 9.11885929107666, 3.545238494873047, + 2.621943950653076, -6.445507526397705, -1.6835596561431885, + 5.52318000793457, -5.958856105804443, -9.169190406799316, + 6.420943737030029, -3.2930312156677246, 1.041016697883606, + -7.2463226318359375, -0.9472730755805969, -5.7783522605896, + 3.1852290630340576, -7.261817932128906, 4.174602508544922, + 3.7802627086639404, -6.071240425109863, -9.909919738769531, + -7.744259357452393, -8.286120414733887, 8.083491325378418 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'hardSwish', + 'arguments': [{'input': 'hardSwishInput'}], + 'outputs': 'hardSwishOutput' + }], + 'expectedOutputs': { + 'hardSwishOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + hardSwishTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getHardSwishPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/identity.https.any.js b/webnn/conformance_tests/identity.https.any.js new file mode 100644 index 00000000000000..ca4239145b142c --- /dev/null +++ b/webnn/conformance_tests/identity.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise identity operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Copy the value of the input tensor to the output tensor, element-wise. +// +// MLOperand identity(MLOperand input); + + +const getIdentityPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const identityTests = [ + { + 'name': 'identity float32 0D scalar', + 'graph': { + 'inputs': { + 'identityInput': { + 'data': [-4.273642539978027], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + 'data': [-4.273642539978027], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 1D constant tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 1D tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 2D tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 3D tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 4D tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'identity float32 5D tensor', + 'graph': { + 'inputs': { + 'identityInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'identity', + 'arguments': [{'input': 'identityInput'}], + 'outputs': 'identityOutput' + }], + 'expectedOutputs': { + 'identityOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + identityTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getIdentityPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/instance_normalization.https.any.js b/webnn/conformance_tests/instance_normalization.https.any.js index 4c5d33bbf70cde..5790b20d8e8025 100644 --- a/webnn/conformance_tests/instance_normalization.https.any.js +++ b/webnn/conformance_tests/instance_normalization.https.any.js @@ -8,6 +8,357 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-instancenorm +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-instancenorm +// Normalize the input using Instance-Normalization. +// +// dictionary MLInstanceNormalizationOptions { +// MLOperand scale; +// MLOperand bias; +// double epsilon = 1e-5; +// MLInputOperandLayout layout = "nchw"; +// }; +// +// MLOperand instanceNormalization( +// MLOperand input, optional MLInstanceNormalizationOptions options = {}); -runWebNNConformanceTests('instanceNormalization', buildLayerNorm); + +const getInstanceNormPrecisionTolerance = (graphResources) => { + // according to + // https://github.com/web-platform-tests/wpt/pull/43891#discussion_r1457026316 + const toleranceValueDict = {float32: 840, float16: 8400}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const instanceNormTests = [ + { + 'name': 'instanceNormalization float32 4D tensor default options', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': [{'input': 'instanceNormInput'}], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'instanceNormalization float32 4D tensor options.scale', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'instanceNormScale': { + 'data': [-94.42772674560547, 66.69620513916016, -98.56572723388672], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': [ + {'input': 'instanceNormInput'}, + {'options': {'scale': 'instanceNormScale'}} + ], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'instanceNormalization float32 4D tensor options.bias', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + }, + 'instanceNormBias': { + 'data': [-33.048641204833984, 4.511423587799072, -37.93617248535156], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': [ + {'input': 'instanceNormInput'}, + {'options': {'bias': 'instanceNormBias'}} + ], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'instanceNormalization float32 4D tensor options.epsilon', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': [ + {'input': 'instanceNormInput'}, {'options': {'epsilon': 0.000001}} + ], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'instanceNormalization float32 4D tensor explict options.layout=\'nchw\'', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': + [{'input': 'instanceNormInput'}, {'options': {'layout': 'nchw'}}], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'instanceNormalization float32 4D tensor options.layout=\'nhwc\'', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': + [{'input': 'instanceNormInput'}, {'options': {'layout': 'nhwc'}}], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'instanceNormalization float32 4D tensor all options', + 'graph': { + 'inputs': { + 'instanceNormInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'instanceNormScale': { + 'data': [-94.42772674560547, 66.69620513916016, -98.56572723388672], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + }, + 'instanceNormBias': { + 'data': [-33.048641204833984, 4.511423587799072, -37.93617248535156], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'instanceNormalization', + 'arguments': [ + {'input': 'instanceNormInput'}, { + 'options': { + 'scale': 'instanceNormScale', + 'bias': 'instanceNormBias', + 'epsilon': 0.000001, + 'layout': 'nhwc' + } + } + ], + 'outputs': 'instanceNormOutput' + }], + 'expectedOutputs': { + 'instanceNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + instanceNormTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getInstanceNormPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/layer_normalization.https.any.js b/webnn/conformance_tests/layer_normalization.https.any.js index f5bfb8c2cc8280..84b90ca2779e20 100644 --- a/webnn/conformance_tests/layer_normalization.https.any.js +++ b/webnn/conformance_tests/layer_normalization.https.any.js @@ -8,6 +8,552 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-layernorm +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-layernorm +// Normalize the input using Layer-Normalization. +// +// dictionary MLLayerNormalizationOptions { +// MLOperand scale; +// MLOperand bias; +// sequence<[EnforceRange] unsigned long> axes; +// double epsilon = 1e-5; +// }; +// +// MLOperand layerNormalization( +// MLOperand input, optional MLLayerNormalizationOptions options = {}); -runWebNNConformanceTests('layerNormalization', buildLayerNorm); + +const getLayerNormPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const layerNormTests = [ + { + 'name': 'layerNormalization float32 2D tensor default options', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [{'input': 'layerNormInput'}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 3D tensor default options', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [{'input': 'layerNormInput'}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor default options', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [{'input': 'layerNormInput'}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 5D tensor default options', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [{'input': 'layerNormInput'}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor options.scale', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + }, + 'layerNormScale': { + 'data': [ + -3.8228423595428467, -5.452458381652832, 0.6776165962219238, + -4.027037620544434, -3.7771618366241455, -9.327335357666016, + 7.1816911697387695, 1.5054303407669067, 3.120894193649292, + 0.5214731693267822, 2.6719748973846436, -3.571370840072632 + ], + 'descriptor': {'dimensions': [1, 4, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [ + {'input': 'layerNormInput'}, {'options': {'scale': 'layerNormScale'}} + ], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor options.bias', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + }, + 'layerNormBias': { + 'data': [ + 7.862982749938965, -3.6603047847747803, -6.955524444580078, + -6.397322654724121, 3.268958568572998, -2.7498080730438232, + -4.080942153930664, -7.137991905212402, 8.465653419494629, + 2.762545108795166, 0.8230442404747009, -3.827561378479004 + ], + 'descriptor': {'dimensions': [1, 4, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [ + {'input': 'layerNormInput'}, {'options': {'bias': 'layerNormBias'}} + ], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor options.axes=[2]', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [{'input': 'layerNormInput'}, {'options': {'axes': [2]}}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor options.epsilon', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': + [{'input': 'layerNormInput'}, {'options': {'epsilon': 0.0001}}], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'layerNormalization float32 4D tensor options.scale and options.axes=[0, 2]', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + }, + 'layerNormScale': { + 'data': [ + 8.72657299041748, -5.388210773468018, -6.811323165893555, + 4.707905292510986, -4.705780029296875, -5.143046855926514, + -1.1115549802780151, 5.250569820404053 + ], + 'descriptor': {'dimensions': [2, 4], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [ + {'input': 'layerNormInput'}, + {'options': {'scale': 'layerNormScale', 'axes': [0, 2]}} + ], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'layerNormalization float32 4D tensor options.bias and options.axes=[3, 1, 2]', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + }, + 'layerNormBias': { + 'data': [ + -0.1396923065185547, -6.156772136688232, 4.363296031951904, + 8.8598051071167, 9.772650718688965, -3.4626545906066895, + 9.744950294494629, -0.3958968222141266, -8.497353553771973, + 6.172536849975586, -2.8930461406707764, 1.7220044136047363 + ], + 'descriptor': {'dimensions': [3, 1, 4], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [ + {'input': 'layerNormInput'}, + {'options': {'bias': 'layerNormBias', 'axes': [3, 1, 2]}} + ], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'layerNormalization float32 4D tensor all options', + 'graph': { + 'inputs': { + 'layerNormInput': { + 'data': [ + -35.51446533203125, 54.735408782958984, 19.659019470214844, + -15.882678031921387, 65.48657989501953, 25.818492889404297, + 97.55302429199219, -8.057161331176758, 62.9412956237793, + -48.91555404663086, 91.90644073486328, 46.67098617553711, + -74.85331726074219, 30.126361846923828, 26.13089370727539, + 59.30270767211914, -60.361995697021484, 18.55615234375, + -88.03730773925781, -26.5667724609375, 70.81292724609375, + 9.105611801147461, 56.66746139526367, 21.78444480895996 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + }, + 'layerNormScale': { + 'data': [ + 7.715926647186279, 1.7371079921722412, 9.13965129852295, + 5.758823394775391, -2.8198351860046387, -0.6866958141326904 + ], + 'descriptor': {'dimensions': [2, 3, 1], 'dataType': 'float32'}, + 'constant': true + }, + 'layerNormBias': { + 'data': [ + -8.710672378540039, -7.642981052398682, 4.937538146972656, + -2.1876745223999023, -4.067612648010254, -6.836254596710205 + ], + 'descriptor': {'dimensions': [2, 3, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'layerNormalization', + 'arguments': [ + {'input': 'layerNormInput'}, { + 'options': { + 'scale': 'layerNormScale', + 'bias': 'layerNormBias', + 'axes': [0, 3, 1], + 'epsilon': 0.0001 + } + } + ], + 'outputs': 'layerNormOutput' + }], + 'expectedOutputs': { + 'layerNormOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + layerNormTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLayerNormPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/leaky_relu.https.any.js b/webnn/conformance_tests/leaky_relu.https.any.js index 9012f02a5edf2d..af4ac23e4444d2 100644 --- a/webnn/conformance_tests/leaky_relu.https.any.js +++ b/webnn/conformance_tests/leaky_relu.https.any.js @@ -8,6 +8,417 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-leakyrelu +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-leakyrelu +// Calculate the leaky version of rectified linear function on the input tensor +// element-wise. The calculation follows the expression +// max(0, x) + alpha * min(0, x). +// +// dictionary MLLeakyReluOptions { +// double alpha = 0.01; +// }; +// +// MLOperand leakyRelu( +// MLOperand input, optional MLLeakyReluOptions options = {}); -runWebNNConformanceTests('leakyRelu', buildOperationWithSingleInput); + +const getLeakyReluPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const leakyReluTests = [ + { + 'name': 'leakyRelu float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 1D tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 2D tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 3D tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 4D tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 5D tensor default options', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 1D tensor negative options.alpha', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [ + {'input': 'leakyReluInput'}, + {'options': {'alpha': -97.70109193608776}} + ], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 2D tensor positive options.alpha', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [ + {'input': 'leakyReluInput'}, + {'options': {'alpha': 35.799162942273234}} + ], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'leakyRelu float32 5D tensor options.alpha=0.0', + 'graph': { + 'inputs': { + 'leakyReluInput': { + 'data': [ + -19.053640365600586, 50.77590560913086, -69.54966735839844, + -80.57432556152344, -90.4011001586914, 76.02884674072266, + 66.33873748779297, -84.10186767578125, -17.19101333618164, + -87.47624206542969, -3.416466474533081, -22.77235984802246, + -2.509489059448242, 18.933284759521484, 98.61402893066406, + 55.3392333984375, -33.17860412597656, -46.03901290893555, + -61.47925567626953, 64.26514434814453, 21.469341278076172, + -31.514690399169922, -41.27694320678711, -65.59529113769531 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'leakyRelu', + 'arguments': [{'input': 'leakyReluInput'}, {'options': {'alpha': 0}}], + 'outputs': 'leakyReluOutput' + }], + 'expectedOutputs': { + 'leakyReluOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + leakyReluTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLeakyReluPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/lesser.https.any.js b/webnn/conformance_tests/lesser.https.any.js index 246c3ed2c26c6b..f7200bc21d8a1d 100644 --- a/webnn/conformance_tests/lesser.https.any.js +++ b/webnn/conformance_tests/lesser.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise lesser operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,531 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-lesser +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Compare if the values of the first input tensor is lesser, element-wise. +// +// MLOperand lesser(MLOperand a, MLOperand b); -runWebNNConformanceTests('lesser', buildOperationWithTwoInputs); + +const getLesserPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const lesserTests = [ + { + 'name': 'lesser float32 0D scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-0.5228080153465271], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [0.8150388598442078], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': + {'data': [1], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'lesser float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 2.945375680923462, 3.730471611022949, 4.0253753662109375, + -4.718355178833008, 6.7732744216918945, -2.042813539505005, + -6.526762008666992, 6.826299667358398, -9.267172813415527, + 6.118423938751221, -2.001732349395752, 1.779831051826477, + 9.660094261169434, -2.7473158836364746, -3.4345006942749023, + -4.751097679138184, -6.092621803283691, -0.4334806203842163, + -1.4069052934646606, -0.23742099106311798, -9.10597038269043, + 6.811779975891113, -6.768326759338379, -8.952353477478027 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 broadcast 0D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-5.678369998931885], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-5.678369998931885], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 3.5869946479797363, -2.853332042694092, -3.684652805328369, + 2.4055018424987793, -4.358371257781982, 5.5484747886657715 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -4.439523696899414, 2.7518322467803955, 3.635943651199341, + -2.8089921474456787 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesser float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-5.678369998931885], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -1.147218942642212, -8.409374237060547, -2.2753310203552246, + -0.5770801305770874, 8.171789169311523, -0.907120943069458, + 5.2908453941345215, -3.9134645462036133, 9.825095176696777, + -8.931730270385742, -3.457401752471924, -7.331232070922852, + 1.232004165649414, 4.312077045440674, 1.2715545892715454, + 4.184540748596191, -6.710920333862305, 3.0768423080444336, + 1.0030865669250488, -9.076244354248047, 8.907161712646484, + 4.232614994049072, 2.1005890369415283, -6.201345443725586 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesser', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + lesserTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLesserPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/lesser_or_equal.https.any.js b/webnn/conformance_tests/lesser_or_equal.https.any.js index 75d60bd73ceeda..fce69f611253b6 100644 --- a/webnn/conformance_tests/lesser_or_equal.https.any.js +++ b/webnn/conformance_tests/lesser_or_equal.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise lesserOrEqual operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,532 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-lesserorequal +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Compare if the values of the first input tensor is lesser or equal, +// element-wise. +// +// MLOperand lesserOrEqual(MLOperand a, MLOperand b); -runWebNNConformanceTests('lesserOrEqual', buildOperationWithTwoInputs); + +const getLesserOrEqualPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const lesserOrEqualTests = [ + { + 'name': 'lesserOrEqual float32 0D scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-6.978766441345215], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [6.613064765930176], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': + {'data': [1], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'lesserOrEqual float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 5.498841285705566, 1.766266107559204, -2.815573215484619, + -6.048312187194824, 9.497536659240723, -2.101574659347534, + -4.079037189483643, 5.314040184020996, 0.03871455416083336, + -0.30728286504745483, 4.97542667388916, 3.462601661682129, + 8.605685234069824, 1.5140480995178223, 2.0090959072113037, + -0.3105867803096771, -4.244836330413818, -3.5506834983825684, + -2.5953285694122314, -4.9998064041137695, 3.118950605392456, + 9.705141067504883, 9.54673957824707, -6.189505577087402 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 broadcast 0D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [4.840610980987549], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [4.840610980987549], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.499547004699707, -8.321310043334961, -7.182070732116699, + 3.418306350708008, 5.389469146728516, 6.904313087463379 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 4.195140838623047, 7.8286590576171875, 6.6902031898498535, + 0.9247010350227356 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'lesserOrEqual float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [4.840610980987549], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.284008979797363, -3.219264507293701, -6.543179988861084, + -0.540285050868988, -5.413843631744385, 5.583743095397949, + 1.50178062915802, 6.5922441482543945, -9.92548656463623, + -7.134799957275391, -4.915772914886475, -9.137166976928711, + 9.40368366241455, -9.831502914428711, -2.0123181343078613, + -6.597689628601074, -8.26932144165039, 8.281030654907227, + 1.64528226852417, -1.4862726926803589, -4.998753547668457, + -0.920993447303772, -9.434256553649902, 9.813238143920898 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'lesserOrEqual', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + lesserOrEqualTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLesserOrEqualPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/linear.https.any.js b/webnn/conformance_tests/linear.https.any.js index c011229db8f1f5..1f092303d6a497 100644 --- a/webnn/conformance_tests/linear.https.any.js +++ b/webnn/conformance_tests/linear.https.any.js @@ -8,6 +8,534 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-linear +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-linear +// Calculate a linear function y = alpha * x + beta on the input tensor. +// +// dictionary MLLinearOptions { +// double alpha = 1; +// double beta = 0; +// }; +// +// MLOperand linear(MLOperand input, optional MLLinearOptions options = {}); -runWebNNConformanceTests('linear', buildOperationWithSingleInput); + +const getLinearPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 2, float16: 2}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const linearTests = [ + { + 'name': 'linear float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'linear float32 1D tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'linear float32 2D tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'linear float32 3D tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'linear float32 4D tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'linear float32 5D tensor default options', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [{'input': 'linearInput'}], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 4D tensor specified options.alpha and default options.beta', + 'graph': { + 'inputs': { + 'linearInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, {'options': {'alpha': 7.398793812746618}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 positive 4D tensor specified positive options.beta and default options.alpha', + 'graph': { + 'inputs': { + 'linearInput': { + 'data': [ + 5.098546028137207, 3.381463050842285, 8.054762840270996, + 8.074773788452148, 0.47079092264175415, 5.243824005126953, + 3.827306032180786, 5.3697686195373535, 6.1033172607421875, + 3.7505786418914795, 0.7479738593101501, 1.8931976556777954, + 1.9056464433670044, 7.863316059112549, 4.58075475692749, + 9.373635292053223, 6.584214210510254, 9.344809532165527, + 5.16057825088501, 0.8060914278030396, 9.130533218383789, + 3.1937403678894043, 5.748293399810791, 4.113487720489502 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, {'options': {'beta': 5.919095653700928}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 negative 4D tensor specified negative options.beta and default options.alpha', + 'graph': { + 'inputs': { + 'linearInput': { + 'data': [ + -5.098546028137207, -3.381463050842285, -8.054762840270996, + -8.074773788452148, -0.47079092264175415, -5.243824005126953, + -3.827306032180786, -5.3697686195373535, -6.1033172607421875, + -3.7505786418914795, -0.7479738593101501, -1.8931976556777954, + -1.9056464433670044, -7.863316059112549, -4.58075475692749, + -9.373635292053223, -6.584214210510254, -9.344809532165527, + -5.16057825088501, -0.8060914278030396, -9.130533218383789, + -3.1937403678894043, -5.748293399810791, -4.113487720489502 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, {'options': {'beta': -5.919095653700928}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 positive 4D tensor all options (positive options.alpha and positive options.beta)', + 'graph': { + 'inputs': { + 'linearInput': { + 'data': [ + 5.098546028137207, 3.381463050842285, 8.054762840270996, + 8.074773788452148, 0.47079092264175415, 5.243824005126953, + 3.827306032180786, 5.3697686195373535, 6.1033172607421875, + 3.7505786418914795, 0.7479738593101501, 1.8931976556777954, + 1.9056464433670044, 7.863316059112549, 4.58075475692749, + 9.373635292053223, 6.584214210510254, 9.344809532165527, + 5.16057825088501, 0.8060914278030396, 9.130533218383789, + 3.1937403678894043, 5.748293399810791, 4.113487720489502 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, + {'options': {'alpha': 7.398793812746618, 'beta': 5.919095653700928}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 positive 4D tensor all options (negative options.alpha and negative options.beta)', + 'graph': { + 'inputs': { + 'linearInput': { + 'data': [ + 5.098546028137207, 3.381463050842285, 8.054762840270996, + 8.074773788452148, 0.47079092264175415, 5.243824005126953, + 3.827306032180786, 5.3697686195373535, 6.1033172607421875, + 3.7505786418914795, 0.7479738593101501, 1.8931976556777954, + 1.9056464433670044, 7.863316059112549, 4.58075475692749, + 9.373635292053223, 6.584214210510254, 9.344809532165527, + 5.16057825088501, 0.8060914278030396, 9.130533218383789, + 3.1937403678894043, 5.748293399810791, 4.113487720489502 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, + {'options': {'alpha': -7.398793812746618, 'beta': -5.919095653700928}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'linear float32 negative 4D tensor all options (positive options.alpha and negative options.beta)', + 'graph': { + 'inputs': { + 'linearInput': { + 'data': [ + -5.098546028137207, -3.381463050842285, -8.054762840270996, + -8.074773788452148, -0.47079092264175415, -5.243824005126953, + -3.827306032180786, -5.3697686195373535, -6.1033172607421875, + -3.7505786418914795, -0.7479738593101501, -1.8931976556777954, + -1.9056464433670044, -7.863316059112549, -4.58075475692749, + -9.373635292053223, -6.584214210510254, -9.344809532165527, + -5.16057825088501, -0.8060914278030396, -9.130533218383789, + -3.1937403678894043, -5.748293399810791, -4.113487720489502 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'linear', + 'arguments': [ + {'input': 'linearInput'}, + {'options': {'alpha': 7.398793812746618, 'beta': -5.919095653700928}} + ], + 'outputs': 'linearOutput' + }], + 'expectedOutputs': { + 'linearOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + linearTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLinearPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/log.https.any.js b/webnn/conformance_tests/log.https.any.js new file mode 100644 index 00000000000000..a8d5b006ebbb6a --- /dev/null +++ b/webnn/conformance_tests/log.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise log operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the natural logarithm of the input tensor, element-wise. +// +// MLOperand log(MLOperand input); + + +const getLogPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 1024}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const logTests = [ + { + 'name': 'log float32 positive 0D scalar', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [63.82542037963867], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + 'data': [4.15615177154541], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 1D constant tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 1D tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 2D tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 3D tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 4D tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'log float32 positive 5D tensor', + 'graph': { + 'inputs': { + 'logInput': { + 'data': [ + 63.82542037963867, 25.317724227905273, 96.44790649414062, + 40.91856384277344, 36.579071044921875, 57.81629943847656, + 10.057244300842285, 17.836828231811523, 50.79246520996094, + 83.860595703125, 12.065509796142578, 22.702478408813477, + 47.559814453125, 17.543880462646484, 32.65243911743164, + 20.353010177612305, 52.54472351074219, 45.608802795410156, + 30.385812759399414, 13.709558486938477, 10.396759986877441, + 50.840946197509766, 5.682034492492676, 94.02275848388672 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'log', + 'arguments': [{'input': 'logInput'}], + 'outputs': 'logOutput' + }], + 'expectedOutputs': { + 'logOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + logTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLogPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/logical_not.https.any.js b/webnn/conformance_tests/logical_not.https.any.js index db0cc4e8c607d3..51db74cd3ae217 100644 --- a/webnn/conformance_tests/logical_not.https.any.js +++ b/webnn/conformance_tests/logical_not.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise logicalNot operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,214 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#dom-mlgraphbuilder-logicalnot +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-logical +// Invert the values of the input tensor to values 0 or 1, element-wise. +// +// MLOperand logicalNot(MLOperand a); -runWebNNConformanceTests('logicalNot', buildOperationWithSingleInput); + +const getLogicalNotPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {uint8: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const logicalNotTests = [ + { + 'name': 'logicalNot uint8 0D scalar', + 'graph': { + 'inputs': { + 'logicalNotInput': + {'data': [1], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': + {'data': [0], 'descriptor': {'dimensions': [], 'dataType': 'uint8'}} + } + } + }, + { + 'name': 'logicalNot uint8 1D constant tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'logicalNot uint8 1D tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'logicalNot uint8 2D tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'logicalNot uint8 3D tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'logicalNot uint8 4D tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + } + } + } + }, + { + 'name': 'logicalNot uint8 5D tensor', + 'graph': { + 'inputs': { + 'logicalNotInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'uint8'} + } + }, + 'operators': [{ + 'name': 'logicalNot', + 'arguments': [{'input': 'logicalNotInput'}], + 'outputs': 'logicalNotOutput' + }], + 'expectedOutputs': { + 'logicalNotOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'uint8'} + } + } + } + } +]; + +if (navigator.ml) { + logicalNotTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getLogicalNotPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/matmul.https.any.js b/webnn/conformance_tests/matmul.https.any.js index 50930d1b0f7310..58410a6046327f 100644 --- a/webnn/conformance_tests/matmul.https.any.js +++ b/webnn/conformance_tests/matmul.https.any.js @@ -8,6 +8,573 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-matmul +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-matmul +// Compute the matrix product of two input tensors. +// MLOperand matmul(MLOperand a, MLOperand b); -runWebNNConformanceTests('matmul', buildOperationWithTwoInputs); + +const getMatmulPrecisionTolerance = (graphResources) => { + const args = graphResources.operators[0].arguments; + const shapeA = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const tolerance = shapeA[shapeA.length - 1] * 2; + const toleranceValueDict = {float32: tolerance, float16: tolerance}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const matmulTests = [ + { + 'name': 'matmul float32 2D and 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 10.43066120147705, 24.467519760131836, 55.887577056884766, + 3.2410826683044434, 87.58891296386719, 22.40154457092285, + 79.85144805908203, 99.64449310302734, 24.740541458129883, + 65.9624252319336, 38.136077880859375, 87.11140441894531 + ], + 'descriptor': {'dimensions': [3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 88.1700439453125, 78.4012680053711, 14.819003105163574, + 3.6923038959503174, 45.906429290771484, 43.083919525146484, + 47.199466705322266, 60.92521667480469, 8.162760734558105, + 20.333263397216797, 20.438398361206055, 27.0194091796875, + 15.601424217224121, 87.46969604492188, 65.79554748535156, + 69.31697082519531, 31.984439849853516, 12.291812896728516, + 13.304834365844727, 85.26705169677734 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 3D and 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 56.46701431274414, 99.86045837402344, 71.054931640625, + 32.454383850097656, 17.310747146606445, 2.586275100708008, + 92.31499481201172, 96.9758529663086, 26.472131729125977, + 77.67031860351562, 29.278789520263672, 82.12142181396484, + 89.89308166503906, 82.49795532226562, 64.36865997314453, + 23.75928497314453, 6.670266628265381, 81.55583190917969, + 16.142963409423828, 57.45134735107422, 26.826417922973633, + 85.02970123291016, 36.1988639831543, 89.60960388183594 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 70.38780212402344, 25.48917579650879, 28.254196166992188, + 84.5148696899414, 58.873416900634766, 46.252838134765625, + 24.897335052490234, 44.0944938659668, 51.86564636230469, + 1.123237133026123, 4.187554836273193, 71.24649810791016, + 16.034526824951172, 23.677297592163086, 61.27727508544922, + 65.15946197509766, 58.39249801635742, 70.12741088867188, + 9.11972713470459, 24.179977416992188, 84.4263687133789, + 78.55551147460938, 38.48297119140625, 80.6541519165039, + 57.152122497558594, 46.109710693359375, 28.41227912902832, + 90.92566680908203, 94.66068267822266, 61.77287673950195, + 60.324859619140625, 70.97433471679688, 10.631051063537598, + 55.61628341674805, 35.052310943603516, 22.12839126586914, + 38.19757843017578, 78.17564392089844, 62.57684326171875, + 88.35256958007812 + ], + 'descriptor': {'dimensions': [2, 4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 4D and 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 56.46701431274414, 99.86045837402344, 71.054931640625, + 32.454383850097656, 17.310747146606445, 2.586275100708008, + 92.31499481201172, 96.9758529663086, 26.472131729125977, + 77.67031860351562, 29.278789520263672, 82.12142181396484, + 89.89308166503906, 82.49795532226562, 64.36865997314453, + 23.75928497314453, 6.670266628265381, 81.55583190917969, + 16.142963409423828, 57.45134735107422, 26.826417922973633, + 85.02970123291016, 36.1988639831543, 89.60960388183594 + ], + 'descriptor': {'dimensions': [2, 1, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 70.38780212402344, 25.48917579650879, 28.254196166992188, + 84.5148696899414, 58.873416900634766, 46.252838134765625, + 24.897335052490234, 44.0944938659668, 51.86564636230469, + 1.123237133026123, 4.187554836273193, 71.24649810791016, + 16.034526824951172, 23.677297592163086, 61.27727508544922, + 65.15946197509766, 58.39249801635742, 70.12741088867188, + 9.11972713470459, 24.179977416992188, 84.4263687133789, + 78.55551147460938, 38.48297119140625, 80.6541519165039, + 57.152122497558594, 46.109710693359375, 28.41227912902832, + 90.92566680908203, 94.66068267822266, 61.77287673950195, + 60.324859619140625, 70.97433471679688, 10.631051063537598, + 55.61628341674805, 35.052310943603516, 22.12839126586914, + 38.19757843017578, 78.17564392089844, 62.57684326171875, + 88.35256958007812 + ], + 'descriptor': {'dimensions': [2, 1, 4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 3D and 3D (broadcast) tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 56.46701431274414, 99.86045837402344, 71.054931640625, + 32.454383850097656, 17.310747146606445, 2.586275100708008, + 92.31499481201172, 96.9758529663086, 26.472131729125977, + 77.67031860351562, 29.278789520263672, 82.12142181396484, + 89.89308166503906, 82.49795532226562, 64.36865997314453, + 23.75928497314453, 6.670266628265381, 81.55583190917969, + 16.142963409423828, 57.45134735107422, 26.826417922973633, + 85.02970123291016, 36.1988639831543, 89.60960388183594 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 27.829805374145508, 83.1454849243164, 34.41289520263672, + 83.20379638671875 + ], + 'descriptor': {'dimensions': [1, 4, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + 'data': [ + 15019.9462890625, 11942.376953125, 15035.0322265625, + 13553.013671875, 12302.328125, 16517.9765625 + ], + 'descriptor': {'dimensions': [2, 3, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 3D and 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 56.46701431274414, 99.86045837402344, 71.054931640625, + 32.454383850097656, 17.310747146606445, 2.586275100708008, + 92.31499481201172, 96.9758529663086, 26.472131729125977, + 77.67031860351562, 29.278789520263672, 82.12142181396484, + 89.89308166503906, 82.49795532226562, 64.36865997314453, + 23.75928497314453, 6.670266628265381, 81.55583190917969, + 16.142963409423828, 57.45134735107422, 26.826417922973633, + 85.02970123291016, 36.1988639831543, 89.60960388183594 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 27.829805374145508, 83.1454849243164, 34.41289520263672, + 83.20379638671875 + ], + 'descriptor': {'dimensions': [4, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + 'data': [ + 15019.9462890625, 11942.376953125, 15035.0322265625, + 13553.013671875, 12302.328125, 16517.9765625 + ], + 'descriptor': {'dimensions': [2, 3, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 4D and 4D (broadcast) tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 33.75957107543945, 97.24552917480469, 83.7085189819336, + 64.53984069824219, 29.57938003540039, 17.19923973083496, + 67.94749450683594, 97.45838165283203, 54.449283599853516, + 29.552200317382812, 51.99970245361328, 36.03101348876953, + 9.701058387756348, 27.04842185974121, 6.020919322967529, + 22.940902709960938, 53.1243896484375, 15.292234420776367, + 48.21302795410156, 87.40799713134766, 51.34442138671875, + 21.1557559967041, 27.589487075805664, 58.412384033203125, + 5.963276386260986, 84.74938201904297, 55.45738220214844, + 50.858699798583984, 23.763574600219727, 62.330928802490234, + 35.774959564208984, 17.340242385864258, 29.16901397705078, + 23.191360473632812, 27.060928344726562, 1.2828527688980103, + 8.720425605773926, 48.45281219482422, 99.0130386352539, + 65.86412048339844, 92.69683074951172, 85.43540954589844, + 37.49127960205078, 51.397132873535156, 53.19015121459961, + 38.33119201660156, 75.20586395263672, 3.8537938594818115 + ], + 'descriptor': {'dimensions': [2, 2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 88.1700439453125, 78.4012680053711, 14.819003105163574, + 3.6923038959503174, 45.906429290771484, 43.083919525146484, + 47.199466705322266, 60.92521667480469, 8.162760734558105, + 20.333263397216797, 20.438398361206055, 27.0194091796875, + 15.601424217224121, 87.46969604492188, 65.79554748535156, + 69.31697082519531, 31.984439849853516, 12.291812896728516, + 13.304834365844727, 85.26705169677734 + ], + 'descriptor': {'dimensions': [1, 1, 4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 4D and 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 33.75957107543945, 97.24552917480469, 83.7085189819336, + 64.53984069824219, 29.57938003540039, 17.19923973083496, + 67.94749450683594, 97.45838165283203, 54.449283599853516, + 29.552200317382812, 51.99970245361328, 36.03101348876953, + 9.701058387756348, 27.04842185974121, 6.020919322967529, + 22.940902709960938, 53.1243896484375, 15.292234420776367, + 48.21302795410156, 87.40799713134766, 51.34442138671875, + 21.1557559967041, 27.589487075805664, 58.412384033203125, + 5.963276386260986, 84.74938201904297, 55.45738220214844, + 50.858699798583984, 23.763574600219727, 62.330928802490234, + 35.774959564208984, 17.340242385864258, 29.16901397705078, + 23.191360473632812, 27.060928344726562, 1.2828527688980103, + 8.720425605773926, 48.45281219482422, 99.0130386352539, + 65.86412048339844, 92.69683074951172, 85.43540954589844, + 37.49127960205078, 51.397132873535156, 53.19015121459961, + 38.33119201660156, 75.20586395263672, 3.8537938594818115 + ], + 'descriptor': {'dimensions': [2, 2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 70.38780212402344, 25.48917579650879, 28.254196166992188, + 84.5148696899414, 58.873416900634766, 46.252838134765625, + 24.897335052490234, 44.0944938659668, 51.86564636230469, + 1.123237133026123, 4.187554836273193, 71.24649810791016, + 16.034526824951172, 23.677297592163086, 61.27727508544922, + 65.15946197509766, 58.39249801635742, 70.12741088867188, + 9.11972713470459, 24.179977416992188, 84.4263687133789, + 78.55551147460938, 38.48297119140625, 80.6541519165039, + 57.152122497558594, 46.109710693359375, 28.41227912902832, + 90.92566680908203, 94.66068267822266, 61.77287673950195, + 60.324859619140625, 70.97433471679688, 10.631051063537598, + 55.61628341674805, 35.052310943603516, 22.12839126586914, + 38.19757843017578, 78.17564392089844, 62.57684326171875, + 88.35256958007812 + ], + 'descriptor': {'dimensions': [2, 4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 5D and 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 33.75957107543945, 97.24552917480469, 83.7085189819336, + 64.53984069824219, 29.57938003540039, 17.19923973083496, + 67.94749450683594, 97.45838165283203, 54.449283599853516, + 29.552200317382812, 51.99970245361328, 36.03101348876953, + 9.701058387756348, 27.04842185974121, 6.020919322967529, + 22.940902709960938, 53.1243896484375, 15.292234420776367, + 48.21302795410156, 87.40799713134766, 51.34442138671875, + 21.1557559967041, 27.589487075805664, 58.412384033203125, + 5.963276386260986, 84.74938201904297, 55.45738220214844, + 50.858699798583984, 23.763574600219727, 62.330928802490234, + 35.774959564208984, 17.340242385864258, 29.16901397705078, + 23.191360473632812, 27.060928344726562, 1.2828527688980103, + 8.720425605773926, 48.45281219482422, 99.0130386352539, + 65.86412048339844, 92.69683074951172, 85.43540954589844, + 37.49127960205078, 51.397132873535156, 53.19015121459961, + 38.33119201660156, 75.20586395263672, 3.8537938594818115 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 88.1700439453125, 78.4012680053711, 14.819003105163574, + 3.6923038959503174, 45.906429290771484, 43.083919525146484, + 47.199466705322266, 60.92521667480469, 8.162760734558105, + 20.333263397216797, 20.438398361206055, 27.0194091796875, + 15.601424217224121, 87.46969604492188, 65.79554748535156, + 69.31697082519531, 31.984439849853516, 12.291812896728516, + 13.304834365844727, 85.26705169677734 + ], + 'descriptor': {'dimensions': [1, 1, 1, 4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'matmul float32 5D and 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 33.75957107543945, 97.24552917480469, 83.7085189819336, + 64.53984069824219, 29.57938003540039, 17.19923973083496, + 67.94749450683594, 97.45838165283203, 54.449283599853516, + 29.552200317382812, 51.99970245361328, 36.03101348876953, + 9.701058387756348, 27.04842185974121, 6.020919322967529, + 22.940902709960938, 53.1243896484375, 15.292234420776367, + 48.21302795410156, 87.40799713134766, 51.34442138671875, + 21.1557559967041, 27.589487075805664, 58.412384033203125, + 5.963276386260986, 84.74938201904297, 55.45738220214844, + 50.858699798583984, 23.763574600219727, 62.330928802490234, + 35.774959564208984, 17.340242385864258, 29.16901397705078, + 23.191360473632812, 27.060928344726562, 1.2828527688980103, + 8.720425605773926, 48.45281219482422, 99.0130386352539, + 65.86412048339844, 92.69683074951172, 85.43540954589844, + 37.49127960205078, 51.397132873535156, 53.19015121459961, + 38.33119201660156, 75.20586395263672, 3.8537938594818115 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 88.1700439453125, 78.4012680053711, 14.819003105163574, + 3.6923038959503174, 45.906429290771484, 43.083919525146484, + 47.199466705322266, 60.92521667480469, 8.162760734558105, + 20.333263397216797, 20.438398361206055, 27.0194091796875, + 15.601424217224121, 87.46969604492188, 65.79554748535156, + 69.31697082519531, 31.984439849853516, 12.291812896728516, + 13.304834365844727, 85.26705169677734 + ], + 'descriptor': {'dimensions': [4, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'matmul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 3, 5], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + matmulTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getMatmulPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/max.https.any.js b/webnn/conformance_tests/max.https.any.js index 2281f3ed0a15a0..0c28b85994da6e 100644 --- a/webnn/conformance_tests/max.https.any.js +++ b/webnn/conformance_tests/max.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise max operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,528 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary maximum of the two input tensors. +// MLOperand max(MLOperand a, MLOperand b); -runWebNNConformanceTests('max', buildOperationWithTwoInputs); + +const getMaxPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const maxTests = [ + { + 'name': 'max float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -34.50435256958008, 85.73471069335938, 25.818017959594727, + -91.37040710449219, 87.01370239257812, 0.17744044959545135, + 74.8826675415039, -4.1699137687683105, -73.76497650146484, + 55.388797760009766, -58.69169616699219, -67.62332916259766, + -89.83531188964844, -8.275739669799805, 97.59577178955078, + -48.968868255615234, 95.34497833251953, -97.36360168457031, + -59.90718078613281, 97.15335083007812, -40.226924896240234, + -61.5142707824707, 33.363243103027344, 12.693191528320312 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [48.26115417480469], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 49.523128509521484, -61.555763244628906, -6.564808368682861, + 93.32227325439453, 3.3104186058044434, -98.31839752197266 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 39.32178497314453, 44.523738861083984, 58.046287536621094, + 84.13702392578125 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'max float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [48.26115417480469], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 17.72909164428711, 88.1480712890625, -12.794827461242676, + 11.817361831665039, 19.51302146911621, -62.87843704223633, + 50.771915435791016, -56.91352081298828, 50.57254409790039, + -96.00484466552734, 50.21434020996094, 20.59501075744629, + -60.699546813964844, -96.84203338623047, 57.25886917114258, + -56.29146194458008, 73.71659851074219, 21.347652435302734, + 79.85667419433594, -22.918458938598633, 1.2300019264221191, + 65.67964935302734, 99.89971160888672, -62.321685791015625 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'max', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + maxTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getMaxPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/min.https.any.js b/webnn/conformance_tests/min.https.any.js index 5d12a1d7e2cb5b..2892bc1ec0f21f 100644 --- a/webnn/conformance_tests/min.https.any.js +++ b/webnn/conformance_tests/min.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise min operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,528 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary minimum of the two input tensors. +// MLOperand min(MLOperand a, MLOperand b); -runWebNNConformanceTests('min', buildOperationWithTwoInputs); + +const getMinPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const minTests = [ + { + 'name': 'min float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -40.10139083862305, 86.25190734863281, 51.280174255371094, + -57.64906311035156, -97.56107330322266, -28.881731033325195, + 80.49571228027344, 46.6654052734375, 62.80685806274414, + 49.81534194946289, -76.52043151855469, 84.5990982055664, + 50.47281265258789, -18.01728630065918, 5.198459148406982, + -47.82608413696289, 46.450077056884766, -71.25122833251953, + -69.85066223144531, 40.676490783691406, -18.700122833251953, + 20.14988136291504, 41.95068359375, 23.482912063598633 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [34.42634582519531], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -19.072668075561523, -78.27516174316406, -13.436244010925293, + -93.01346588134766, -72.27899169921875, 63.14110565185547 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 23.231731414794922, 84.62673950195312, -83.33529663085938, + -22.82455825805664 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'min float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [34.42634582519531], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -36.06953048706055, -38.2254524230957, 62.07444381713867, + -16.610267639160156, 65.99324798583984, -17.77212905883789, + -76.01380920410156, -69.59134674072266, 53.60376739501953, + -39.096099853515625, 96.94400787353516, -40.39130401611328, + 74.14437103271484, 0.03283197432756424, 38.79835510253906, + -17.720787048339844, 17.383201599121094, -82.3099365234375, + -80.47379302978516, -31.389848709106445, -73.2723617553711, + -33.74562072753906, -21.70152473449707, 4.945605278015137 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'min', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + minTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getMinPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/mul.https.any.js b/webnn/conformance_tests/mul.https.any.js index 94ead346449deb..d46a4d9074464d 100644 --- a/webnn/conformance_tests/mul.https.any.js +++ b/webnn/conformance_tests/mul.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise mul operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,532 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary multiplication of the two input tensors. +// MLOperand mul(MLOperand a, MLOperand b); -runWebNNConformanceTests('mul', buildOperationWithTwoInputs); + +const getMulPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const mulTests = [ + { + 'name': 'mul float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 74.96137237548828, -34.53953170776367, -33.316162109375, + 53.92023849487305, -83.69075012207031, 19.785221099853516, + 36.28113555908203, -34.31147766113281, 49.10429000854492, + -54.538848876953125, 70.77384948730469, -55.18768310546875, + -93.96234130859375, 60.08298110961914, -92.7341537475586, + 87.6099853515625, -8.881865501403809, 71.79511260986328, + -26.158620834350586, -18.935443878173828, 34.6467170715332, + -60.95826721191406, -11.119653701782227, 77.50324249267578 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [67.50372314453125], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -97.29339599609375, -81.70872497558594, -63.859336853027344, + -25.192203521728516, 94.61557006835938, -20.381790161132812 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 8.696772575378418, 48.377689361572266, 97.7515869140625, + 62.21574783325195 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'mul float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [67.50372314453125], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 49.1112174987793, 11.907459259033203, -21.115795135498047, + 70.7490005493164, -94.51628112792969, -93.78905487060547, + 11.178888320922852, -32.80592346191406, 83.31897735595703, + 91.1207275390625, -0.11235756427049637, 15.397955894470215, + -13.459217071533203, -50.6264762878418, -31.17625617980957, + -6.616114139556885, 21.72757911682129, 22.03150749206543, + -84.02171325683594, -94.06755828857422, 58.807273864746094, + -63.059783935546875, 3.3092827796936035, 9.884003639221191 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'mul', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + mulTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getMulPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/neg.https.any.js b/webnn/conformance_tests/neg.https.any.js new file mode 100644 index 00000000000000..8ffe3623567206 --- /dev/null +++ b/webnn/conformance_tests/neg.https.any.js @@ -0,0 +1,319 @@ +// META: title=test WebNN API element-wise neg operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the numerical negative value of the input tensor, element-wise. +// +// MLOperand neg(MLOperand input); + + +const getNegPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const negTests = [ + { + 'name': 'neg float32 positive 0D scalar', + 'graph': { + 'inputs': { + 'negInput': { + 'data': [94.23045349121094], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + 'data': [-94.23045349121094], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 negative 0D scalar', + 'graph': { + 'inputs': { + 'negInput': { + 'data': [-58.334503173828125], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + 'data': [58.334503173828125], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 1D constant tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 1D tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 2D tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 3D tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 4D tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'neg float32 5D tensor', + 'graph': { + 'inputs': { + 'negInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'neg', + 'arguments': [{'input': 'negInput'}], + 'outputs': 'negOutput' + }], + 'expectedOutputs': { + 'negOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + negTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getNegPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/pad.https.any.js b/webnn/conformance_tests/pad.https.any.js index ec9c106e6330fe..c05f18f83c2800 100644 --- a/webnn/conformance_tests/pad.https.any.js +++ b/webnn/conformance_tests/pad.https.any.js @@ -8,6 +8,730 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-pad +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-pad +// Inflate the tensor with constant or mirrored values on the edges. +// +// enum MLPaddingMode { +// "constant", +// "edge", +// "reflection", +// "symmetric" +// }; +// +// dictionary MLPadOptions { +// MLPaddingMode mode = "constant"; +// MLNumber value = 0; +// }; +// +// MLOperand pad( +// MLOperand input, sequence<[EnforceRange] unsigned long>beginningPadding, +// sequence<[EnforceRange] unsigned long>endingPadding, +// optional MLPadOptions options = {}); -runWebNNConformanceTests('pad', buildPad); + +const getPadPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const padTests = [ + { + 'name': 'pad float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [9], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1]}, + {'endingPadding': [1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + 'data': [ + 0, 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547, 0 + ], + 'descriptor': {'dimensions': [11], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 1D tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [9], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1]}, + {'endingPadding': [1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + 'data': [ + 0, 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547, 0 + ], + 'descriptor': {'dimensions': [11], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 2D tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1, 1]}, + {'endingPadding': [1, 1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 3D tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1, 1, 1]}, + {'endingPadding': [1, 1, 1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 4D tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [0, 1, 1, 1]}, + {'endingPadding': [0, 1, 1, 1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 5D tensor default options', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [0, 1, 1, 0, 1]}, + {'endingPadding': [0, 1, 1, 0, 1]} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 5, 5, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 2D tensor explicit options.mode=\'constant\'', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1, 1]}, + {'endingPadding': [1, 1]}, {'options': {'mode': 'constant'}} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 2D tensor options.value default constant mode', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [3, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [1, 1]}, + {'endingPadding': [1, 1]}, {'options': {'value': 1}} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [5, 5], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 4D tensor options.mode=\'edge\'', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [0, 2, 2, 0]}, + {'endingPadding': [0, 2, 2, 0]}, {'options': {'mode': 'edge'}} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 7, 7, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 4D tensor options.mode=\'reflection\'', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [0, 2, 2, 0]}, + {'endingPadding': [0, 2, 2, 0]}, {'options': {'mode': 'reflection'}} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 7, 7, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pad float32 4D tensor options.mode=\'symmetric\'', + 'graph': { + 'inputs': { + 'padInput': { + 'data': [ + 22.76361846923828, -21.168529510498047, -91.66168975830078, + 16.863798141479492, 60.51472091674805, -70.56755065917969, + -60.643272399902344, -47.8821907043457, 68.72557830810547 + ], + 'descriptor': {'dimensions': [1, 3, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pad', + 'arguments': [ + {'input': 'padInput'}, {'beginningPadding': [0, 2, 2, 0]}, + {'endingPadding': [0, 2, 2, 0]}, {'options': {'mode': 'symmetric'}} + ], + 'outputs': 'padOutput' + }], + 'expectedOutputs': { + 'padOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 7, 7, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + padTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getPadPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/parallel-compute.https.any.js b/webnn/conformance_tests/parallel-compute.https.any.js index ea1b5dbdc44917..3b9c41276ad3cb 100644 --- a/webnn/conformance_tests/parallel-compute.https.any.js +++ b/webnn/conformance_tests/parallel-compute.https.any.js @@ -8,13 +8,48 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlcontext-compute +// https://www.w3.org/TR/webnn/#api-mlcontext-compute + +/** + * WebNN parallel compute operation test. + */ +const testParallelCompute = () => { + let mlContext; + let mlGraph; + + promise_setup(async () => { + try { + mlContext = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } + // Construct a simple graph: A = B * 2. + const builder = new MLGraphBuilder(mlContext); + const operandType = {dataType: 'float32', dimensions: [1]}; + const inputOperand = builder.input('input', operandType); + const constOperand = builder.constant(operandType, Float32Array.from([2])); + const outputOperand = builder.mul(inputOperand, constOperand); + mlGraph = await builder.build({'output': outputOperand}); + }); + + promise_test(async () => { + const testInputs = [1, 2, 3, 4]; + + const actualOutputs = await Promise.all(testInputs.map(async (input) => { + let inputs = {'input': Float32Array.from([input])}; + let outputs = {'output': new Float32Array(1)}; + ({inputs, outputs} = await mlContext.compute(mlGraph, inputs, outputs)); + return outputs.output[0]; + })); + + const expectedOutputs = [2, 4, 6, 8]; + assert_array_equals(actualOutputs, expectedOutputs); + }); +}; if (navigator.ml) { testParallelCompute(); } else { - // Show indication to users why the test failed - test( - () => assert_not_equals( - navigator.ml, undefined, 'ml property is defined on navigator')); + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); } diff --git a/webnn/conformance_tests/pooling.https.any.js b/webnn/conformance_tests/pooling.https.any.js index 83eea50a12f002..9dfd6ba0ca4b4a 100644 --- a/webnn/conformance_tests/pooling.https.any.js +++ b/webnn/conformance_tests/pooling.https.any.js @@ -8,7 +8,2299 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-pool2d +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-pool2d +// Compute a pooling operation across all the elements within the moving window +// over the input tensor. +// +// enum MLRoundingType { +// "floor", +// "ceil" +// }; +// +// dictionary MLPool2dOptions { +// sequence<[EnforceRange] unsigned long> windowDimensions; +// sequence<[EnforceRange] unsigned long> padding; +// sequence<[EnforceRange] unsigned long> strides; +// sequence<[EnforceRange] unsigned long> dilations; +// MLInputOperandLayout layout = "nchw"; +// MLRoundingType roundingType = "floor"; +// sequence<[EnforceRange] unsigned long> outputSizes; +// }; +// +// MLOperand averagePool2d( +// MLOperand input, optional MLPool2dOptions options = {}); +// MLOperand l2Pool2d( +// MLOperand input, optional MLPool2dOptions options = {}); +// MLOperand maxPool2d( +// MLOperand input, optional MLPool2dOptions options = {}); -runWebNNConformanceTests( - ['averagePool2d', 'l2Pool2d', 'maxPool2d'], buildOperationWithSingleInput); + +const getPoolingOperatorsPrecisionTolerance = (graphResources) => { + const args = graphResources.operators[0].arguments; + const inputShape = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const options = + args.length === 2 ? {...args[1][Object.keys(args[1])[0]]} : {}; + let height; + let width; + + 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; + const toleranceDict = { + averagePool2d: {float32: tolerance, float16: tolerance}, + l2Pool2d: {float32: tolerance, float16: tolerance}, + maxPool2d: {float32: 0, float16: 0}, + }; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return { + metricType: 'ULP', + value: toleranceDict[graphResources.operators[0].name][expectedDataType] + }; +}; + +const poolingOperatorsTests = [ + // averagePool2d tests + { + 'name': + 'averagePool2d float32 4D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [{'input': 'averagePool2dInput'}], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor all positive default options', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [{'input': 'averagePool2dInput'}], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor all negative default options', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + -83.87757873535156, -2.0740277767181396, -7.561108589172363, + -45.274261474609375, -16.36655616760254, -44.908512115478516, + -42.04186248779297, -44.77231979370117, -1.5066279172897339, + -52.65203857421875, -92.01856231689453, -48.004093170166016, + -61.522972106933594, -93.44403839111328, -25.780330657958984, + -95.51873779296875, -10.963757514953613, -59.132747650146484, + -32.60173797607422, -21.4510440826416, -87.115966796875, + -61.326114654541016, -41.989723205566406, -87.8764877319336, + -71.69316101074219, -80.24160766601562, -97.48886108398438, + -75.89422607421875, -45.08991622924805, -88.27134704589844, + -90.71282958984375, -93.32392120361328, -59.14753341674805, + -45.33106231689453, -51.32562255859375, -31.154796600341797, + -31.62424087524414, -62.80168151855469, -63.558509826660156, + -68.96183013916016, -43.09415054321289, -15.803443908691406, + -64.31092071533203, -66.45872497558594, -42.027252197265625, + -26.032955169677734, -22.73752784729004, -70.32036590576172, + -85.28227996826172, -92.10668182373047 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [{'input': 'averagePool2dInput'}], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [-49.258975982666016, -60.52408981323242], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.windowDimensions', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'windowDimensions': [3, 3]}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'global averagePool2d float32 4D tensor all positive options.windowDimensions', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'windowDimensions': [5, 5]}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.padding', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'padding': [1, 0, 0, 1]}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [ + 52.43666076660156, 49.84208297729492, 47.26926803588867, + 46.15715408325195, 46.63268280029297, 43.616947174072266, + 44.72445297241211, 44.05451583862305 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.strides', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'strides': [2, 2]}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [ + 43.46498107910156, 42.7481689453125, 32.15948486328125, + 54.00202560424805, 49.65404510498047, 35.84912109375, + 41.17021942138672, 38.987247467041016 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.dilations', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'dilations': [2, 2]}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [32.2001838684082, 42.971012115478516], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.layout=nchw', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': + [{'input': 'averagePool2dInput'}, {'options': {'layout': 'nchw'}}], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.layout=nhwc', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 91.59549713134766, 78.15438079833984, + 65.64701080322266, 9.686111450195312, 55.14215087890625, + 51.298038482666016, 18.432437896728516, 32.193084716796875, + 49.34624099731445, 87.65037536621094, 15.648024559020996, + 87.25082397460938, 68.02723693847656, 39.49794006347656, + 20.342548370361328, 80.0996322631836, 26.727949142456055, + 10.220142364501953, 64.87446594238281, 52.602699279785156, + 46.5671501159668, 1.4128639698028564, 79.57833099365234, + 11.95406436920166, 4.33846378326416, 85.00074768066406, + 38.183837890625, 64.78374481201172, 45.25398254394531, + 88.03128814697266, 80.9718017578125, 11.333850860595703, + 67.58124542236328, 70.61659240722656, 6.0264997482299805, + 84.90442657470703, 29.7788143157959, 79.06687927246094, + 58.58993148803711, 7.3287248611450195, 2.2384984493255615, + 35.97796630859375, 14.50549030303955, 10.177306175231934, + 68.72449493408203, 1.4140757322311401, 76.45657348632812, + 78.10037994384766, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': + [{'input': 'averagePool2dInput'}, {'options': {'layout': 'nhwc'}}], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'global averagePool2d float32 4D tensor options.layout=nhwc and options.windowDimensions', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 91.59549713134766, 78.15438079833984, + 65.64701080322266, 9.686111450195312, 55.14215087890625, + 51.298038482666016, 18.432437896728516, 32.193084716796875, + 49.34624099731445, 87.65037536621094, 15.648024559020996, + 87.25082397460938, 68.02723693847656, 39.49794006347656, + 20.342548370361328, 80.0996322631836, 26.727949142456055, + 10.220142364501953, 64.87446594238281, 52.602699279785156, + 46.5671501159668, 1.4128639698028564, 79.57833099365234, + 11.95406436920166, 4.33846378326416, 85.00074768066406, + 38.183837890625, 64.78374481201172, 45.25398254394531, + 88.03128814697266, 80.9718017578125, 11.333850860595703, + 67.58124542236328, 70.61659240722656, 6.0264997482299805, + 84.90442657470703, 29.7788143157959, 79.06687927246094, + 58.58993148803711, 7.3287248611450195, 2.2384984493255615, + 35.97796630859375, 14.50549030303955, 10.177306175231934, + 68.72449493408203, 1.4140757322311401, 76.45657348632812, + 78.10037994384766, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, + {'options': {'windowDimensions': [5, 5], 'layout': 'nhwc'}} + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [47.26926803588867, 44.72445297241211], + 'descriptor': {'dimensions': [1, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.roundingType=floor', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor' + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [ + 54.20252990722656, 37.16582489013672, 50.038944244384766, + 58.46046447753906, 52.73374557495117, 39.1442985534668, + 43.23125457763672, 32.67961120605469 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'averagePool2d float32 4D tensor options.roundingType=ceil', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil' + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'averagePool2d float32 4D tensor options.layout=nhwc and options.roundingType=floor', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 91.59549713134766, 78.15438079833984, + 65.64701080322266, 9.686111450195312, 55.14215087890625, + 51.298038482666016, 18.432437896728516, 32.193084716796875, + 49.34624099731445, 87.65037536621094, 15.648024559020996, + 87.25082397460938, 68.02723693847656, 39.49794006347656, + 20.342548370361328, 80.0996322631836, 26.727949142456055, + 10.220142364501953, 64.87446594238281, 52.602699279785156, + 46.5671501159668, 1.4128639698028564, 79.57833099365234, + 11.95406436920166, 4.33846378326416, 85.00074768066406, + 38.183837890625, 64.78374481201172, 45.25398254394531, + 88.03128814697266, 80.9718017578125, 11.333850860595703, + 67.58124542236328, 70.61659240722656, 6.0264997482299805, + 84.90442657470703, 29.7788143157959, 79.06687927246094, + 58.58993148803711, 7.3287248611450195, 2.2384984493255615, + 35.97796630859375, 14.50549030303955, 10.177306175231934, + 68.72449493408203, 1.4140757322311401, 76.45657348632812, + 78.10037994384766, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'layout': 'nhwc', + 'roundingType': 'floor' + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [ + 54.20252990722656, 52.73374557495117, 37.16582489013672, + 39.1442985534668, 50.038944244384766, 43.23125457763672, + 58.46046447753906, 32.67961120605469 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'averagePool2d float32 4D tensor options.layout=nhwc and options.roundingType=ceil', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 91.59549713134766, 78.15438079833984, + 65.64701080322266, 9.686111450195312, 55.14215087890625, + 51.298038482666016, 18.432437896728516, 32.193084716796875, + 49.34624099731445, 87.65037536621094, 15.648024559020996, + 87.25082397460938, 68.02723693847656, 39.49794006347656, + 20.342548370361328, 80.0996322631836, 26.727949142456055, + 10.220142364501953, 64.87446594238281, 52.602699279785156, + 46.5671501159668, 1.4128639698028564, 79.57833099365234, + 11.95406436920166, 4.33846378326416, 85.00074768066406, + 38.183837890625, 64.78374481201172, 45.25398254394531, + 88.03128814697266, 80.9718017578125, 11.333850860595703, + 67.58124542236328, 70.61659240722656, 6.0264997482299805, + 84.90442657470703, 29.7788143157959, 79.06687927246094, + 58.58993148803711, 7.3287248611450195, 2.2384984493255615, + 35.97796630859375, 14.50549030303955, 10.177306175231934, + 68.72449493408203, 1.4140757322311401, 76.45657348632812, + 78.10037994384766, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'layout': 'nhwc', + 'roundingType': 'ceil' + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 3, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'averagePool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor', + 'outputSizes': [3, 3] + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'averagePool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 22.975555419921875, 78.15438079833984, 9.686111450195312, + 51.298038482666016, 32.193084716796875, 87.65037536621094, + 87.25082397460938, 39.49794006347656, 80.0996322631836, + 10.220142364501953, 52.602699279785156, 1.4128639698028564, + 11.95406436920166, 85.00074768066406, 64.78374481201172, + 88.03128814697266, 11.333850860595703, 70.61659240722656, + 84.90442657470703, 79.06687927246094, 7.3287248611450195, + 35.97796630859375, 10.177306175231934, 1.4140757322311401, + 78.10037994384766, 91.59549713134766, 65.64701080322266, + 55.14215087890625, 18.432437896728516, 49.34624099731445, + 15.648024559020996, 68.02723693847656, 20.342548370361328, + 26.727949142456055, 64.87446594238281, 46.5671501159668, + 79.57833099365234, 4.33846378326416, 38.183837890625, + 45.25398254394531, 80.9718017578125, 67.58124542236328, + 6.0264997482299805, 29.7788143157959, 58.58993148803711, + 2.2384984493255615, 14.50549030303955, 68.72449493408203, + 76.45657348632812, 23.53263282775879 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil', + 'outputSizes': [2, 2] + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + 'data': [ + 54.20252990722656, 37.16582489013672, 50.038944244384766, + 58.46046447753906, 52.73374557495117, 39.1442985534668, + 43.23125457763672, 32.67961120605469 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'averagePool2d float32 4D tensor options.dilations with options.strides', + 'graph': { + 'inputs': { + 'averagePool2dInput': { + 'data': [ + 70.71148681640625, 99.33489990234375, 76.41767883300781, + 39.40980911254883, 38.16328811645508, 45.971256256103516, + 65.3527603149414, 64.51607513427734, 7.725966930389404, + 41.7672004699707, 94.92633819580078, 53.475772857666016, + 95.46460723876953, 58.461795806884766, 15.831390380859375, + 78.41020202636719, 24.454092025756836, 20.630916595458984, + 32.06352233886719, 47.85192108154297, 91.60813903808594, + 72.3534927368164, 74.69429779052734, 28.860214233398438, + 71.82395935058594, 7.989691734313965, 88.16659545898438, + 58.69850540161133, 63.6061897277832, 55.88187789916992, + 52.809974670410156, 72.91474151611328, 46.957664489746094, + 22.10279655456543, 87.14309692382812, 89.6496810913086, + 63.19610595703125, 11.760882377624512, 70.68730926513672, + 57.70444107055664, 1.183821439743042, 25.26912498474121, + 95.29122924804688, 1.9658530950546265, 53.368465423583984, + 21.400854110717773, 55.86185836791992, 27.824508666992188, + 7.642839431762695, 82.34233093261719, 91.75215911865234, + 62.79155731201172, 28.11526107788086, 28.72478675842285, + 29.887035369873047, 66.4310302734375, 7.0103044509887695, + 34.33702087402344, 73.20159912109375, 7.8835601806640625, + 17.82563591003418, 33.799156188964844, 65.01251220703125, + 30.264028549194336, 75.76551818847656, 21.150800704956055, + 60.84249496459961, 98.56522369384766, 62.60990905761719, + 42.42991256713867, 53.142147064208984, 36.29545974731445, + 79.95863342285156, 79.60734558105469, 16.059114456176758, + 19.27552032470703, 53.93022918701172, 48.41620635986328, + 93.00965118408203, 62.086524963378906, 83.50532531738281, + 61.07964324951172, 75.51439666748047, 54.193782806396484, + 2.572873830795288, 59.47652053833008, 34.22541427612305, + 13.07015323638916, 12.419061660766602, 55.82337188720703, + 4.553813934326172, 63.47830581665039, 62.3555908203125, + 56.961090087890625, 34.77016067504883, 0.9611223936080933, + 35.30686950683594, 98.00790405273438 + ], + 'descriptor': {'dimensions': [1, 7, 7, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'averagePool2d', + 'arguments': [ + {'input': 'averagePool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'layout': 'nhwc' + } + } + ], + 'outputs': 'averagePool2dOutput' + }], + 'expectedOutputs': { + 'averagePool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 3, 3, 2], 'dataType': 'float32'} + } + } + } + }, + + // l2Pool2d tests + { + 'name': 'l2Pool2d float32 4D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [{'input': 'l2Pool2dInput'}], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [289.01953125, 292.6146545410156], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor default all positive options', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [{'input': 'l2Pool2dInput'}], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [289.01953125, 292.6146545410156], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor default all negative options', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + -1.1957088708877563, -9.706199645996094, -39.54935836791992, + -82.34971618652344, -32.87415313720703, -50.22603225708008, + -31.17849349975586, -55.817893981933594, -46.70829391479492, + -38.68181228637695, -63.299320220947266, -35.09224319458008, + -80.93848419189453, -82.8619613647461, -40.41627502441406, + -34.86458206176758, -84.33639526367188, -84.11852264404297, + -5.525088787078857, -99.03114318847656, -75.505126953125, + -91.43389129638672, -96.71258544921875, -16.722585678100586, + -17.98292350769043, -58.06570816040039, -11.846800804138184, + -97.90313720703125, -38.69822692871094, -80.19510650634766, + -48.72047805786133, -90.86722564697266, -99.10758209228516, + -79.70288848876953, -59.3824462890625, -9.967330932617188, + -39.27534866333008, -10.469644546508789, -27.565326690673828, + -2.0468990802764893, -81.88761901855469, -66.88040161132812, + -85.98504638671875, -29.674592971801758, -19.649417877197266, + -89.39192199707031, -61.13504409790039, -84.16869354248047, + -77.36112213134766, -91.17266082763672 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [{'input': 'l2Pool2dInput'}], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [298.928955078125, 326.83587646484375], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.windowDimensions', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, {'options': {'windowDimensions': [3, 3]}} + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 194.45481872558594, 189.54539489746094, 189.85488891601562, + 160.0518341064453, 167.1435546875, 149.63897705078125, + 161.15570068359375, 190.5449981689453, 168.4636688232422, + 170.331787109375, 155.60073852539062, 174.72145080566406, + 165.07762145996094, 165.45819091796875, 161.11062622070312, + 176.6307373046875, 174.245361328125, 180.60714721679688 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.padding', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, {'options': {'padding': [1, 0, 0, 1]}} + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 254.81358337402344, 233.14259338378906, 289.01953125, + 269.777587890625, 241.52200317382812, 212.99337768554688, + 292.6146545410156, 253.77178955078125 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.strides', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'strides': [2, 2]}} + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 194.45481872558594, 189.85488891601562, 161.15570068359375, + 168.4636688232422, 170.331787109375, 174.72145080566406, + 176.6307373046875, 180.60714721679688 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.dilations', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'dilations': [2, 2]}} + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [189.47933959960938, 207.25343322753906], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.layout=nchw', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': + [{'input': 'l2Pool2dInput'}, {'options': {'layout': 'nchw'}}], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [289.01953125, 292.6146545410156], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.layout=nhwc', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 52.027313232421875, 76.55464172363281, + 6.397815227508545, 62.71847152709961, 84.54785919189453, + 83.8726577758789, 18.622516632080078, 73.10235595703125, + 34.10626220703125, 41.52470779418945, 73.96932220458984, + 39.3339729309082, 36.1437873840332, 86.59486389160156, + 60.73781967163086, 23.09039306640625, 55.09187316894531, + 53.650146484375, 63.8924446105957, 0.00902052316814661, + 59.36124038696289, 42.78899383544922, 50.91202926635742, + 81.03960418701172, 50.339813232421875, 33.48585510253906, + 59.31963348388672, 33.67196273803711, 70.78031921386719, + 0.42822372913360596, 35.56179428100586, 80.07991790771484, + 82.53382873535156, 5.929991722106934, 7.572360038757324, + 48.89164733886719, 61.90089416503906, 15.282920837402344, + 14.084012985229492, 13.335721969604492, 90.86540985107422, + 39.06557846069336, 39.56248474121094, 97.06050109863281, + 67.77167510986328, 83.68133544921875, 69.69512176513672, + 21.79571533203125, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': + [{'input': 'l2Pool2dInput'}, {'options': {'layout': 'nhwc'}}], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [289.01953125, 292.6146545410156], + 'descriptor': {'dimensions': [1, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.roundingType=floor', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor' + } + } + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 171.5061492919922, 164.9919891357422, 160.0518341064453, + 149.63897705078125, 142.6990966796875, 139.51637268066406, + 165.07762145996094, 161.11062622070312 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.roundingType=ceil', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil' + } + } + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 171.5061492919922, 164.9919891357422, 8222.29296875, + 160.0518341064453, 149.63897705078125, 65.15908813476562, + 132.56260681152344, 139.84808349609375, 708.620849609375, + 142.6990966796875, 139.51637268066406, 5245.4814453125, + 165.07762145996094, 161.11062622070312, 96.38701629638672, + 150.1616668701172, 146.8201904296875, 8216.69921875 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'l2Pool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor', + 'outputSizes': [3, 3] + } + } + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 171.5061492919922, 164.9919891357422, 8222.29296875, + 160.0518341064453, 149.63897705078125, 65.15908813476562, + 132.56260681152344, 139.84808349609375, 708.620849609375, + 142.6990966796875, 139.51637268066406, 5245.4814453125, + 165.07762145996094, 161.11062622070312, 96.38701629638672, + 150.1616668701172, 146.8201904296875, 8216.69921875 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'l2Pool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 94.07447814941406, 76.55464172363281, 62.71847152709961, + 83.8726577758789, 73.10235595703125, 41.52470779418945, + 39.3339729309082, 86.59486389160156, 23.09039306640625, + 53.650146484375, 0.00902052316814661, 42.78899383544922, + 81.03960418701172, 33.48585510253906, 33.67196273803711, + 0.42822372913360596, 80.07991790771484, 5.929991722106934, + 48.89164733886719, 15.282920837402344, 13.335721969604492, + 39.06557846069336, 97.06050109863281, 83.68133544921875, + 21.79571533203125, 52.027313232421875, 6.397815227508545, + 84.54785919189453, 18.622516632080078, 34.10626220703125, + 73.96932220458984, 36.1437873840332, 60.73781967163086, + 55.09187316894531, 63.8924446105957, 59.36124038696289, + 50.91202926635742, 50.339813232421875, 59.31963348388672, + 70.78031921386719, 35.56179428100586, 82.53382873535156, + 7.572360038757324, 61.90089416503906, 14.084012985229492, + 90.86540985107422, 39.56248474121094, 67.77167510986328, + 69.69512176513672, 89.54518127441406 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil', + 'outputSizes': [2, 2] + } + } + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 171.5061492919922, 164.9919891357422, 160.0518341064453, + 149.63897705078125, 142.6990966796875, 139.51637268066406, + 165.07762145996094, 161.11062622070312 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'l2Pool2d float32 4D tensor options.dilations with options.strides', + 'graph': { + 'inputs': { + 'l2Pool2dInput': { + 'data': [ + 6.5550384521484375, 26.254413604736328, 28.47271156311035, + 64.81202697753906, 39.65838623046875, 10.465584754943848, + 47.94060134887695, 42.208946228027344, 36.834041595458984, + 68.50249481201172, 2.0496721267700195, 49.73927688598633, + 59.97947311401367, 71.08380889892578, 0.20033331215381622, + 19.39293670654297, 70.1269302368164, 86.8837661743164, + 84.28858184814453, 9.695697784423828, 62.69126510620117, + 51.924110412597656, 5.412675857543945, 70.82118225097656, + 81.61302947998047, 29.148712158203125, 85.83409881591797, + 71.36548614501953, 44.09445571899414, 58.343570709228516, + 43.37118148803711, 54.025882720947266, 85.50556945800781, + 93.19215393066406, 10.992993354797363, 34.864158630371094, + 96.2605209350586, 44.29584503173828, 61.12482833862305, + 79.62699127197266, 4.066447734832764, 64.89644622802734, + 97.5897445678711, 11.257055282592773, 61.151283264160156, + 20.312341690063477, 39.862640380859375, 68.747314453125, + 89.61034393310547, 22.28224754333496, 41.36311721801758, + 62.9378662109375, 79.54936218261719, 55.64254379272461, + 54.47548294067383, 77.04864501953125, 56.83576965332031, + 80.57747650146484, 70.43293762207031, 85.67094421386719, + 19.527807235717773, 33.87490463256836, 14.498117446899414, + 92.85955810546875, 96.8167724609375, 28.399721145629883, + 99.917236328125, 48.76692199707031, 86.08634948730469, + 47.32324981689453, 7.223662376403809, 82.97200775146484, + 38.374778747558594, 22.10988426208496, 14.797550201416016, + 2.3872148990631104, 83.26342010498047, 46.41500473022461, + 28.659175872802734, 13.919462203979492, 55.413089752197266, + 62.68498992919922, 78.54127502441406, 31.142845153808594, + 4.806727886199951, 33.233642578125, 24.749773025512695, + 1.529007077217102, 42.976322174072266, 93.08572387695312, + 77.908935546875, 45.74395751953125, 62.868892669677734, + 60.689762115478516, 20.046878814697266, 13.203198432922363, + 33.33952713012695, 0.5279953479766846 + ], + 'descriptor': {'dimensions': [1, 7, 7, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'l2Pool2d', + 'arguments': [ + {'input': 'l2Pool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'dilations': [1, 1], + 'layout': 'nhwc' + } + } + ], + 'outputs': 'l2Pool2dOutput' + }], + 'expectedOutputs': { + 'l2Pool2dOutput': { + 'data': [ + 120.20333862304688, 114.0977783203125, 127.63969421386719, + 119.95613861083984, 137.89837646484375, 152.24261474609375, + 194.9647216796875, 168.20205688476562, 197.7173309326172, + 169.85887145996094, 195.1484832763672, 190.96127319335938, + 158.64576721191406, 166.2051544189453, 171.07916259765625, + 148.70985412597656, 218.7123260498047, 153.33311462402344 + ], + 'descriptor': {'dimensions': [1, 3, 3, 2], 'dataType': 'float32'} + } + } + } + }, + + // maxPool2d tests + { + 'name': 'maxPool2d float32 4D constant tensor default options', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [{'input': 'maxPool2dInput'}], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [99.28312683105469, 81.73119354248047], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor default options', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [{'input': 'maxPool2dInput'}], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [99.28312683105469, 81.73119354248047], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.windowDimensions', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, {'options': {'windowDimensions': [3, 3]}} + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.padding', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, {'options': {'padding': [1, 0, 0, 1]}} + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [ + 99.28312683105469, 99.28312683105469, 99.28312683105469, + 99.28312683105469, 81.73119354248047, 72.8883056640625, + 81.73119354248047, 72.8883056640625 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.strides', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'strides': [2, 2]}} + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [ + 99.28312683105469, 66.09259033203125, 97.90348052978516, + 72.1085205078125, 81.73119354248047, 72.44898986816406, + 80.30484008789062, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.dilations', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, + {'options': {'windowDimensions': [3, 3], 'dilations': [2, 2]}} + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [89.00830078125, 72.33577728271484], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.layout=nchw', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': + [{'input': 'maxPool2dInput'}, {'options': {'layout': 'nchw'}}], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [99.28312683105469, 81.73119354248047], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.layout=nhwc', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -76.72171020507812, -45.72039031982422, + 50.217063903808594, -61.306129455566406, -52.895477294921875, + -4.014514446258545, -44.642333984375, -94.54893493652344, + -97.86752319335938, 46.28090286254883, 81.73119354248047, + 99.28312683105469, 5.428491115570068, -10.057873725891113, + -29.22772789001465, 9.742474555969238, 72.44898986816406, + -39.03501892089844, -59.34124755859375, 75.08192443847656, + 39.19960021972656, 12.819415092468262, -65.99439239501953, + -33.01505661010742, -4.204323768615723, 38.691341400146484, + -60.54586410522461, 66.09259033203125, 55.890525817871094, + 97.90348052978516, 80.30484008789062, -8.737770080566406, + 72.8883056640625, -53.42162322998047, -46.59611129760742, + 72.1085205078125, 20.50387954711914, -40.423091888427734, + -31.126462936401367, -35.68864440917969, -57.294559478759766, + -87.64779663085938, -26.623577117919922, 38.874244689941406, + 15.935754776000977, 39.383602142333984, -78.77953338623047, + 7.429088115692139, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 5, 5, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': + [{'input': 'maxPool2dInput'}, {'options': {'layout': 'nhwc'}}], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [99.28312683105469, 81.73119354248047], + 'descriptor': {'dimensions': [1, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.roundingType=floor', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor' + } + } + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [ + 99.28312683105469, 9.742474555969238, 99.28312683105469, + 72.1085205078125, 81.73119354248047, 72.44898986816406, + 81.73119354248047, 72.44898986816406 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'maxPool2d float32 4D tensor options.roundingType=ceil', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil' + } + } + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'maxPool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'floor', + 'outputSizes': [3, 3] + } + } + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'maxPool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 89.00830078125, -45.72039031982422, -61.306129455566406, + -4.014514446258545, -94.54893493652344, 46.28090286254883, + 99.28312683105469, -10.057873725891113, 9.742474555969238, + -39.03501892089844, 75.08192443847656, 12.819415092468262, + -33.01505661010742, 38.691341400146484, 66.09259033203125, + 97.90348052978516, -8.737770080566406, -53.42162322998047, + 72.1085205078125, -40.423091888427734, -35.68864440917969, + -87.64779663085938, 38.874244689941406, 39.383602142333984, + 7.429088115692139, -76.72171020507812, 50.217063903808594, + -52.895477294921875, -44.642333984375, -97.86752319335938, + 81.73119354248047, 5.428491115570068, -29.22772789001465, + 72.44898986816406, -59.34124755859375, 39.19960021972656, + -65.99439239501953, -4.204323768615723, -60.54586410522461, + 55.890525817871094, 80.30484008789062, 72.8883056640625, + -46.59611129760742, 20.50387954711914, -31.126462936401367, + -57.294559478759766, -26.623577117919922, 15.935754776000977, + -78.77953338623047, 72.33577728271484 + ], + 'descriptor': {'dimensions': [1, 2, 5, 5], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'roundingType': 'ceil', + 'outputSizes': [2, 2] + } + } + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + 'data': [ + 99.28312683105469, 9.742474555969238, 99.28312683105469, + 72.1085205078125, 81.73119354248047, 72.44898986816406, + 81.73119354248047, 72.44898986816406 + ], + 'descriptor': {'dimensions': [1, 2, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'maxPool2d float32 4D tensor options.dilations with options.strides', + 'graph': { + 'inputs': { + 'maxPool2dInput': { + 'data': [ + 34.69258117675781, -24.706249237060547, -60.428070068359375, + 35.93883514404297, 60.896095275878906, 79.42220306396484, + -77.85906219482422, 54.188209533691406, -21.576934814453125, + -49.10390853881836, 78.55176544189453, 74.28213500976562, + -87.92769622802734, 79.82047271728516, 11.680922508239746, + -12.154505729675293, -22.33293914794922, 33.084861755371094, + 8.640676498413086, 47.040645599365234, 95.7823486328125, + -88.01998138427734, -98.53630065917969, 16.158977508544922, + 21.396089553833008, 95.1323471069336, -40.80724334716797, + -88.70922088623047, -40.772769927978516, 67.89842987060547, + -50.337467193603516, -96.56610870361328, 12.508098602294922, + -6.6358113288879395, -44.80198287963867, 80.27474212646484, + -65.68411254882812, -14.884790420532227, -66.54857635498047, + 20.072338104248047, -27.954269409179688, -56.62217330932617, + 82.7479476928711, 93.30175018310547, -34.073394775390625, + -22.87164306640625, 73.25525665283203, 41.14021682739258, + -19.75514793395996, 80.07701110839844, -69.89276885986328, + 14.013250350952148, -61.36640167236328, 51.53046417236328, + 43.53886413574219, -89.5888671875, 51.45121765136719, + 73.9239730834961, -80.25264739990234, 94.72747802734375, + 95.25411224365234, 58.12575149536133, 19.885723114013672, + -70.0301284790039, 63.419517517089844, -54.11785125732422, + -97.22807312011719, -60.65826416015625, -31.04998016357422, + -14.646553039550781, -63.73688888549805, 47.34630584716797, + 85.56405639648438, -53.389251708984375, -70.84739685058594, + 47.355045318603516, 83.38397979736328, 7.361695289611816, + 46.85823440551758, 98.13465881347656, -43.9396858215332, + 50.33780288696289, 37.45563507080078, -54.52760696411133, + -6.212307929992676, 34.41734313964844, 11.8167724609375, + 72.44517517089844, 86.3460922241211, 4.14656925201416, + 88.33040618896484, 98.29994201660156, -66.72379302978516, + 58.0643424987793, -51.168277740478516, -17.768583297729492, + 9.961172103881836, -52.73843002319336 + ], + 'descriptor': {'dimensions': [1, 7, 7, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'maxPool2d', + 'arguments': [ + {'input': 'maxPool2dInput'}, { + 'options': { + 'windowDimensions': [3, 3], + 'padding': [1, 0, 0, 1], + 'strides': [2, 2], + 'dilations': [1, 1], + 'layout': 'nhwc' + } + } + ], + 'outputs': 'maxPool2dOutput' + }], + 'expectedOutputs': { + 'maxPool2dOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 3, 3, 2], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + poolingOperatorsTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getPoolingOperatorsPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/pow.https.any.js b/webnn/conformance_tests/pow.https.any.js index c988e92d917751..3da766df69df61 100644 --- a/webnn/conformance_tests/pow.https.any.js +++ b/webnn/conformance_tests/pow.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise pow operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,605 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary power of the two input tensors. +// MLOperand pow(MLOperand a, MLOperand b); -runWebNNConformanceTests('pow', buildOperationWithTwoInputs); + +const getPowPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 32, float16: 2}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const powTests = [ + { + 'name': + 'pow float32 constant 1D base tensor and 1D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pow float32 1D base tensor and 1D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pow float32 2D base tensor and 2D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pow float32 3D base tensor and 3D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pow float32 4D base tensor and 4D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'pow float32 5D base tensor and 5D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'pow (square) float32 4D base tensor and broadcastable 0D integer exponent scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [2], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'pow (sqrt) float32 4D positive base tensor and broadcastable 0D integer exponent scalar', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 1.418652057647705, 19.384845733642578, 12.983916282653809, + 2.4603159427642822, 7.818154811859131, 6.94444465637207, + 12.183951377868652, 17.912473678588867, 11.356568336486816, + 8.924248695373535, 17.636823654174805, 11.49622917175293, + 18.516279220581055, 2.2580490112304688, 2.231948137283325, + 13.629855155944824, 17.54841423034668, 0.5390734076499939, + 5.891367435455322, 0.12803149223327637, 19.654495239257812, + 3.4122724533081055, 4.945034980773926, 4.437101364135742 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [0.5], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'pow float32 4D base tensor and broadcastable 2D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [5, -10, -10, 7, -7, -9], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'pow float32 4D base tensor and broadcastable 3D integer exponent tensor', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 17.846010208129883, -0.0631069764494896, -9.868203163146973, + 11.17772102355957, -17.346275329589844, 11.862250328063965, + -16.832275390625, 2.6574816703796387, -2.783346652984619, + -13.756400108337402, 13.131382942199707, -0.4376337230205536, + -15.678689002990723, 10.283306121826172, 14.893174171447754, + -4.941208362579346, -14.231812477111816, 3.2646026611328125, + 17.229148864746094, -2.885918140411377, -1.4400150775909424, + -5.757015705108643, 17.41126823425293, 17.41521453857422 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [-5, -10, 9, -6], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'pow', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + powTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getPowPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/prelu.https.any.js b/webnn/conformance_tests/prelu.https.any.js index 3b4717663fa86e..4730d4e2d17ac5 100644 --- a/webnn/conformance_tests/prelu.https.any.js +++ b/webnn/conformance_tests/prelu.https.any.js @@ -8,6 +8,620 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-prelu +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-prelu +// Calculate the parametric version of rectified linear function (Parametric +// ReLU) on the input tensor element-wise. The calculation follows the +// expression max(0, x) + slope * min(0, x). +// +// MLOperand prelu(MLOperand input, MLOperand slope); -runWebNNConformanceTests('prelu', buildOperationWithTwoInputs); + +const getPreluPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const preluTests = [ + { + 'name': 'prelu float32 0D scalar', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [-4.794857501983643], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [1.1202747821807861], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + 'data': [-5.371557712554932], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 1D constant tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 1D tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 2D tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 3D tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 4D tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 5D tensors', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 9.343092918395996, 0.2800687253475189, -4.617084980010986, + 1.1202747821807861, -1.4334710836410522, -3.157594919204712, + -6.28995418548584, -5.0107879638671875, -6.899077415466309, + 3.5725347995758057, 6.861966609954834, -1.961531400680542, + 4.5832037925720215, 2.6643502712249756, 9.192955017089844, + -9.554699897766113, -5.505102157592773, -2.3927369117736816, + 3.58212947845459, -2.3224003314971924, -1.9816573858261108, + 4.155889987945557, -1.799522042274475, 9.295849800109863 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 broadcast 4D x 1D slope', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [5.073923110961914, 0.480774462223053, -7.091750144958496], + 'descriptor': {'dimensions': [3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 broadcast 4D x 1D slope of shape [1]', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [5.0114545822143555], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 broadcast 4D x 2D slope', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [ + 4.874276161193848, -8.501633644104004, 1.1819270849227905, + -9.985190391540527, -4.424202919006348, -6.654683589935303 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 broadcast 4D x 3D slope', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [5.073923110961914, 0.480774462223053, -7.091750144958496], + 'descriptor': {'dimensions': [1, 1, 3], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'prelu float32 broadcast 4D x 4D slope', + 'graph': { + 'inputs': { + 'preluInput': { + 'data': [ + -2.549168109893799, -4.794857501983643, 8.413617134094238, + 6.108623504638672, -8.492292404174805, 3.3143365383148193, + 1.1687211990356445, -0.141762837767601, -6.714652061462402, + 5.787421703338623, -3.755627393722534, -4.89828634262085, + 7.3295159339904785, -3.9542298316955566, 7.067296981811523, + 9.439736366271973, -2.558180093765259, -8.658834457397461, + 8.47507381439209, 4.551425457000732, -9.267870903015137, + -0.262177437543869, 1.3258955478668213, -7.41831111907959 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'}, + 'constant': true + }, + 'preluSlope': { + 'data': [5.0114545822143555], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'prelu', + 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], + 'outputs': 'preluOutput' + }], + 'expectedOutputs': { + 'preluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + preluTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getPreluPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/reciprocal.https.any.js b/webnn/conformance_tests/reciprocal.https.any.js new file mode 100644 index 00000000000000..a97c00e2b996ba --- /dev/null +++ b/webnn/conformance_tests/reciprocal.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise reciprocal operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the reciprocal of the input tensor, element-wise. +// +// MLOperand reciprocal(MLOperand input); + + +const getReciprocalPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 2, float16: 2}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const reciprocalTests = [ + { + 'name': 'reciprocal float32 0D scalar', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [-9.36349105834961], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + 'data': [-0.10679777711629868], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 1D constant tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 1D tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 2D tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 3D tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 4D tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reciprocal float32 5D tensor', + 'graph': { + 'inputs': { + 'reciprocalInput': { + 'data': [ + -1.0110862255096436, 4.6215386390686035, 2.417376756668091, + -8.934871673583984, -3.3485584259033203, -8.803302764892578, + 8.826321601867676, 6.572828769683838, 6.639494895935059, + 2.6842703819274902, -4.627160549163818, -6.873653411865234, + -1.1854121685028076, 0.9572811722755432, 0.02132055163383484, + 0.35645851492881775, 4.827780246734619, 1.3128081560134888, + 8.246277809143066, -0.2039169818162918, -9.039937019348145, + 9.942809104919434, -9.540112495422363, -0.08022662252187729 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reciprocal', + 'arguments': [{'input': 'reciprocalInput'}], + 'outputs': 'reciprocalOutput' + }], + 'expectedOutputs': { + 'reciprocalOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + reciprocalTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getReciprocalPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/reduction.https.any.js b/webnn/conformance_tests/reduction.https.any.js index f5247ee137c6bf..895ffea92a55f8 100644 --- a/webnn/conformance_tests/reduction.https.any.js +++ b/webnn/conformance_tests/reduction.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API reduction operation +// META: title=test WebNN API reduction operations // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,19 +8,5752 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-reduce - -runWebNNConformanceTests( - [ - 'reduceL1', - 'reduceL2', - 'reduceLogSum', - 'reduceLogSumExp', - 'reduceMax', - 'reduceMean', - 'reduceMin', - 'reduceProduct', - 'reduceSum', - 'reduceSumSquare', - ], - buildOperationWithSingleInput); +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-reduce +// Reduce the input tensor along all dimensions, or along the axes specified in +// the axes array parameter. +// +// dictionary MLReduceOptions { +// sequence<[EnforceRange] unsigned long> axes; +// boolean keepDimensions = false; +// }; +// +// MLOperand reduceL1(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceL2(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceLogSum( +// MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceLogSumExp( +// MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceMax(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceMean(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceMin(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceProduct( +// MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceSum(MLOperand input, optional MLReduceOptions options = {}); +// MLOperand reduceSumSquare( +// MLOperand input, optional MLReduceOptions options = {}); + + +const getReductionOperatorsPrecisionTolerance = (graphResources) => { + const operatorName = graphResources.operators[0].name; + const args = graphResources.operators[0].arguments; + const inputShape = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const rank = inputShape.length; + const options = + args.length === 2 ? {...args[1][Object.keys(args[1])[0]]} : {}; + let sizes; + + if (options && options.axes) { + sizes = options.axes.map( + (axis) => axis < 0 ? inputShape[axis + rank] : inputShape[axis]); + } else { + sizes = inputShape; + } + + const reducedElementCount = sizes.length ? + sizes.reduce((accumulator, currentValue) => accumulator * currentValue) : + 1; + let tolerance; + + switch (operatorName) { + 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; + } + + const toleranceValueDict = { + reduceL1: {float32: tolerance, float16: tolerance}, + reduceL2: {float32: tolerance, float16: tolerance}, + reduceLogSum: {float32: tolerance, float16: tolerance}, + reduceLogSumExp: {float32: tolerance, float16: tolerance}, + reduceMax: {float32: 0, float16: 0}, + reduceMean: {float32: tolerance, float16: tolerance}, + reduceMin: {float32: 0, float16: 0}, + reduceProduct: {float32: tolerance, float16: tolerance}, + reduceSum: {float32: tolerance, float16: tolerance}, + reduceSumSquare: {float32: tolerance, float16: tolerance}, + }; + + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return { + metricType: 'ULP', + value: toleranceValueDict[operatorName][expectedDataType] + }; +}; + +const reductionOperatorsTests = [ + // reduceL1 tests + { + 'name': 'reduceL1 float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [5.50882625579834], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 5.50882625579834, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [5.50882625579834], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}, {'options': {'axes': []}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 5.50882625579834, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + -98.83928680419922, -57.66743850708008, -57.101200103759766, + -6.693042278289795, -45.30584716796875, -86.68338775634766, + -74.71875, -76.46739959716797, -75.37677001953125, + -18.22093963623047, -54.64426803588867, -36.45240020751953, + -18.322681427001953, -47.94379425048828, -40.19978332519531, + -15.830483436584473, -48.883358001708984, -41.600242614746094, + -20.6556339263916, -92.2993392944336, -46.28858184814453, + -80.57186126708984, -25.49472999572754, -48.96730041503906 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1215.228515625, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 993, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1344, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [ + 142.01541137695312, 106.62430572509766, 175.39280700683594, + 286.7269592285156, 169.36322021484375, 212.59750366210938 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [ + 258.57110595703125, 174.42807006835938, 102.19830322265625, + 134.52191162109375, 207.92910766601562, 215.07168579101562 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [1092.72021484375], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': 1092.72021484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL1 float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [1092.72021484375], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceL1 float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [ + 108.43173217773438, 315.6007995605469, 359.5506591796875, + 309.13702392578125 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceL1 float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.50882625579834, 50.61575698852539, 1.6773051023483276, + 84.2135238647461, 15.664374351501465, 52.89714813232422, + 9.125157356262207, 28.937623977661133, 12.567061424255371, + 11.39999008178711, 86.91246032714844, 64.51329803466797, + 71.2834243774414, 76.34410858154297, 41.53409194946289, + 97.5653305053711, 31.803831100463867, 6.089754581451416, + 61.70843505859375, 69.76119232177734, 38.919403076171875, + 52.288333892822266, 22.31783676147461, 99.0719223022461 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [ + 108.43173217773438, 315.6007995605469, 359.5506591796875, + 309.13702392578125 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceL2 tests + { + 'name': 'reduceL2 float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [4.860228061676025], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 4.860228061676025, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [4.860228061676025], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}, {'options': {'axes': []}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 4.860228061676025, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + -66.80043029785156, -53.00004959106445, -59.58587646484375, + -46.14392852783203, -49.60614013671875, -12.832738876342773, + -88.05061340332031, -75.56246185302734, -50.76777648925781, + -36.96630096435547, -26.344043731689453, -58.90546417236328, + -94.28752899169922, -22.7802791595459, -84.3487777709961, + -60.47734451293945, -41.455806732177734, -92.84781646728516, + -85.05448913574219, -30.235260009765625, -47.33808135986328, + -25.268428802490234, -78.11959075927734, -28.330944061279297 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 292.57574462890625, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 274.4029846191406, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 300.3830871582031, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [ + 122.352783203125, 124.8213119506836, 128.20062255859375, + 128.14801025390625, 87.18083953857422, 55.043975830078125 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [ + 114.44775390625, 110.26422882080078, 133.47344970703125, + 64.96752166748047, 128.0914764404297, 101.677734375 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [272.0996398925781], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': 272.0996398925781, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceL2 float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [272.0996398925781], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceL2 float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [ + 138.580078125, 166.67791748046875, 149.91552734375, 67.6578598022461 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceL2 float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.860228061676025, 88.23184204101562, 54.489688873291016, + 64.75027465820312, 6.855991363525391, 91.39871215820312, + 41.88857650756836, 73.65444946289062, 35.31573486328125, + 48.345428466796875, 82.39190673828125, 77.86200714111328, + 93.31141662597656, 62.48688507080078, 60.29290008544922, + 13.230599403381348, 20.535987854003906, 53.45161819458008, + 11.320085525512695, 64.75763702392578, 43.6589469909668, + 0.8374307155609131, 0.6848266124725342, 33.504703521728516 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [ + 138.580078125, 166.67791748046875, 149.91552734375, 67.6578598022461 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceLogSum tests + { + 'name': 'reduceLogSum float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [64.54827117919922], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 4.167413234710693, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [64.54827117919922], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 4.167413234710693, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSum float32 1D constant tensor all non-negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 1D tensor all non-negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSum float32 1D tensor all non-negative integers default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.063048362731934, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [ + 5.593751907348633, 4.773046016693115, 5.3115739822387695, + 5.2497639656066895, 4.973392486572266, 5.373587131500244 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [ + 5.410027980804443, 5.367736339569092, 5.399682998657227, + 4.652334213256836, 4.744638442993164, 5.565346717834473 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.039101600646973], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': 7.039101600646973, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSum float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.039101600646973], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSum float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [ + 5.7273993492126465, 5.64375114440918, 5.453810214996338, + 5.758983135223389 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSum float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.54827117919922, 97.87423706054688, 26.529027938842773, + 79.79046630859375, 50.394989013671875, 14.578407287597656, + 20.866817474365234, 32.43873596191406, 64.91233825683594, + 71.54029846191406, 11.137068748474121, 55.079307556152344, + 43.791351318359375, 13.831947326660156, 97.39019775390625, + 35.507755279541016, 52.27586364746094, 82.83865356445312, + 8.568099021911621, 0.8337112069129944, 69.23146057128906, + 3.8541641235351562, 70.5567398071289, 71.99264526367188 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [ + 5.7273993492126465, 5.64375114440918, 5.453810214996338, + 5.758983135223389 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceLogSumExp tests + { + 'name': 'reduceLogSumExp float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [0.7974132895469666], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 0.7974132895469666, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [0.7974132895469666], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 0.7974132895469666, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + -4.025670051574707, -9.444348335266113, -3.1193981170654297, + -5.943697929382324, -0.3701804578304291, -4.397126197814941, + -6.605968475341797, -5.534277439117432, -7.361471176147461, + -1.9987547397613525, -9.093968391418457, -8.693618774414062, + -8.416788101196289, -1.010741114616394, -9.814584732055664, + -9.725259780883789, -9.157071113586426, -0.001698818989098072, + -9.963415145874023, -5.991659641265869, -6.180599689483643, + -1.2336505651474, -0.44234341382980347, -6.990072250366211 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 1.1666961908340454, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 9.607237815856934, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 0.7001367211341858, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [ + 8.55212688446045, 3.985233783721924, 5.52872896194458, + 9.081488609313965, 6.996237754821777, 9.759706497192383 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [ + 4.66951847076416, 9.08117961883545, 8.533217430114746, + 9.270560264587402, 6.450263977050781, 8.917200088500977 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.39477825164795], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': 10.39477825164795, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.39477825164795], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [ + 8.563796997070312, 5.500619411468506, 9.753945350646973, + 9.20864486694336 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.7974132895469666, 5.046889781951904, 8.520371437072754, + 1.4063042402267456, 0.11882661283016205, 0.2858544886112213, + 1.9325640201568604, 3.7939958572387695, 2.6040232181549072, + 4.937509536743164, 4.571482181549072, 0.786512017250061, + 0.21018670499324799, 9.063042640686035, 4.099809646606445, + 4.596248626708984, 0.2549232244491577, 1.159480094909668, + 6.802876949310303, 5.234325408935547, 8.914905548095703, + 9.166799545288086, 5.717507362365723, 0.3255050778388977 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [ + 8.563796997070312, 5.500619411468506, 9.753945350646973, + 9.20864486694336 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceMax tests + { + 'name': 'reduceMax float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [32.16658401489258], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 32.16658401489258, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [32.16658401489258], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 32.16658401489258, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [ + 90.42288208007812, 75.90379333496094, 94.99645233154297, + 96.55397033691406, 99.77313232421875, 20.253753662109375 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': + [{'input': 'reduceMaxInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [ + 62.504642486572266, 96.55397033691406, 99.77313232421875, + -21.557384490966797, 94.99645233154297, 37.28493118286133 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [99.77313232421875], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': 99.77313232421875, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMax float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [99.77313232421875], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMax float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [ + 90.42288208007812, 94.99645233154297, 96.55397033691406, + 99.77313232421875 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMax float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.16658401489258, 90.42288208007812, -26.341794967651367, + -7.147959232330322, 75.90379333496094, -48.2042121887207, + -53.09425354003906, 66.66099548339844, -96.16854095458984, + -88.30545043945312, 94.99645233154297, 37.28493118286133, + -42.209861755371094, 96.55397033691406, 0.8807229995727539, + 62.504642486572266, 36.650634765625, 99.77313232421875, + -72.86485290527344, -46.03200912475586, 20.253753662109375, + -21.557384490966797, -51.28727340698242, -42.58832931518555 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [ + 90.42288208007812, 94.99645233154297, 96.55397033691406, + 99.77313232421875 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceMean tests + { + 'name': 'reduceMean float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [95.84498596191406], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 95.84498596191406, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [95.84498596191406], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 95.84498596191406, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMean float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + -37.14686965942383, -44.500423431396484, -6.1265482902526855, + -6.321793079376221, -76.53897857666016, -4.137692928314209, + -20.76356315612793, -38.749176025390625, -36.81039810180664, + -26.274377822875977, -12.566819190979004, -55.28200912475586, + -20.69756507873535, -34.19586181640625, -45.36003112792969, + -34.996192932128906, -67.84308624267578, -0.7434244155883789, + -21.981258392333984, -61.31269454956055, -58.598960876464844, + -76.02980041503906, -23.91740608215332, -22.94187355041504 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': -34.74319839477539, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMean float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 48.41666793823242, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMean float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': -47.54166793823242, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [ + 45.46687316894531, 49.670711517333984, 50.94768142700195, + 44.734745025634766, 27.777833938598633, 23.264999389648438 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': + [{'input': 'reduceMeanInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [ + 54.82453536987305, 40.251548767089844, 22.060470581054688, + 48.58541488647461, 51.343353271484375, 24.797523498535156 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [40.31047439575195], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': 40.31047439575195, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMean float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [40.31047439575195], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMean float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [ + 52.287559509277344, 45.10261917114258, 47.640018463134766, + 16.211700439453125 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMean float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.84498596191406, 75.6937026977539, 1.5417721271514893, + 8.787034034729004, 70.08280181884766, 13.784331321716309, + 20.006067276000977, 94.80963897705078, 25.82918930053711, + 94.13260650634766, 67.72958374023438, 16.09935188293457, + 92.1943359375, 11.567352294921875, 52.70549774169922, + 22.471792221069336, 3.662332534790039, 20.210277557373047, + 58.56523132324219, 28.673492431640625, 42.13419723510742, + 21.63775062561035, 14.160697937011719, 15.127351760864258 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [ + 52.287559509277344, 45.10261917114258, 47.640018463134766, + 16.211700439453125 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceMin tests + { + 'name': 'reduceMin float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [-58.76195526123047], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -58.76195526123047, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [-58.76195526123047], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -58.76195526123047, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [ + -87.9623031616211, -39.50931167602539, -53.747413635253906, + -31.713542938232422, -84.4076919555664, -55.97655487060547 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': + [{'input': 'reduceMinInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -59.40851974487305, -84.4076919555664, -53.747413635253906 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9623031616211], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': -87.9623031616211, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceMin float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9623031616211], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMin float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [ + -87.9623031616211, -53.747413635253906, -84.4076919555664, + -55.97655487060547 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceMin float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.76195526123047, -87.9623031616211, -70.13690185546875, + -53.61766815185547, -39.50931167602539, 76.48815155029297, + -18.705087661743164, 44.78261947631836, 30.70233917236328, + 61.46361541748047, 77.84043884277344, -53.747413635253906, + -31.713542938232422, -9.735438346862793, 77.9365234375, + 99.01705932617188, 73.39929962158203, 92.0845947265625, + -59.40851974487305, -84.4076919555664, 75.88834381103516, + 96.02651977539062, -55.97655487060547, -1.7911018133163452 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [ + -87.9623031616211, -53.747413635253906, -84.4076919555664, + -55.97655487060547 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceProduct tests + { + 'name': 'reduceProduct float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [-68.75911712646484], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': -68.75911712646484, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [-68.75911712646484], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': -68.75911712646484, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [ + 7519895, -1292816.375, 2441721.75, -110637.7734375, -7380313.5, + -818030.5 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [ + 4227263.5, -446960.5625, 3811296.75, 1280298.5, -1343475.375, + 1280118.75 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [1.5855958784642327e+37], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': 1.5855958784642327e+37, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceProduct float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [1.5855958784642327e+37], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceProduct float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-3638925568, 6523364352, -414643360, 1610916352], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceProduct float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + -68.75911712646484, 99.44961547851562, 24.86055564880371, + -44.23515319824219, -22.699743270874023, 79.97555541992188, + 14.4650239944458, 49.23109436035156, 30.058706283569336, + 69.45106506347656, -20.15709686279297, -58.0255126953125, + 51.896610260009766, -2.020799160003662, 39.392974853515625, + 26.78073501586914, -97.97651672363281, 48.66154479980469, + -85.19523620605469, -18.16986083984375, 64.83759307861328, + -14.95883846282959, -74.50932312011719, -11.319679260253906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-3638925568, 6523364352, -414643360, 1610916352], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceSum tests + { + 'name': 'reduceSum float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [69.6038589477539], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 69.6038589477539, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [69.6038589477539], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 69.6038589477539, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + -51.77016830444336, -34.46467971801758, -40.98350524902344, + -83.34922790527344, -67.67525482177734, -18.7031192779541, + -20.28106117248535, -20.12305450439453, -83.63451385498047, + -23.651084899902344, -10.208438873291016, -36.2129020690918, + -76.26201629638672, -9.094745635986328, -53.889339447021484, + -67.52340698242188, -71.14580535888672, -82.04484558105469, + -96.29924774169922, -68.46700286865234, -26.107192993164062, + -68.0182113647461, -4.8330769538879395, -48.900699615478516 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': -1163.642578125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1307, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': -1216, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [ + 210.44241333007812, 104.54179382324219, 226.2177734375, + 239.025390625, 260.405029296875, 273.2470397949219 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': + [{'input': 'reduceSumInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [ + 179.63900756835938, 260.37457275390625, 219.3611297607422, + 246.83712768554688, 157.4895782470703, 250.1780242919922 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [1313.87939453125], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': 1313.87939453125, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSum float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [1313.87939453125], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSum float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [ + 355.21942138671875, 185.98255920410156, 362.3598937988281, + 410.3175354003906 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSum float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.6038589477539, 99.17485809326172, 32.78234100341797, + 8.881362915039062, 16.094295501708984, 11.80689525604248, + 32.64223861694336, 43.99836349487305, 77.01776885986328, + 79.79425811767578, 45.00794982910156, 24.397796630859375, + 57.502685546875, 57.60173034667969, 80.26985931396484, + 43.65110778808594, 87.5036849975586, 94.50203704833984, + 35.54289627075195, 42.856414794921875, 88.58631896972656, + 98.85772705078125, 25.626853942871094, 60.1761360168457 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [ + 355.21942138671875, 185.98255920410156, 362.3598937988281, + 410.3175354003906 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + + // reduceSumSquare tests + { + 'name': 'reduceSumSquare float32 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [52.5615348815918], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 2762.71484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [52.5615348815918], + 'descriptor': {'dimensions': [], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 2762.71484375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float32 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + -21.45201301574707, -57.30725860595703, -72.8390121459961, + -0.059761520475149155, -71.73678588867188, -44.61909103393555, + -43.12002182006836, -91.3373794555664, -33.17243957519531, + -48.555931091308594, -95.6286392211914, -20.876630783081055, + -16.690837860107422, -39.52110290527344, -7.5107855796813965, + -90.59027099609375, -42.21683120727539, -76.74274444580078, + -98.22420501708984, -60.272953033447266, -74.73202514648438, + -8.543684005737305, -59.888736724853516, -17.99894142150879 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 80052.015625, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float32 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 71347, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float32 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73634, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 9709.013671875, 10817.7685546875, 14548.470703125, 16385.8515625, + 9287.357421875, 12527.3974609375 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 8585.87109375, 7700.654296875, 19889.1796875, 7113.0439453125, + 16775.708984375, 13211.3994140625 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [73275.859375], + 'descriptor': {'dimensions': [1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': 73275.859375, + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reduceSumSquare float32 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [73275.859375], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float32 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 12302.474609375, 22772.77734375, 26919.09765625, 11281.5068359375 + ], + 'descriptor': {'dimensions': [2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float32 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 52.5615348815918, 2.6261062622070312, 82.04877471923828, + 14.401411056518555, 33.96051788330078, 83.9383773803711, + 47.445045471191406, 19.177289962768555, 13.493006706237793, + 44.152381896972656, 86.53118133544922, 70.20919799804688, + 25.67262840270996, 79.73770141601562, 66.42284393310547, + 70.40363311767578, 13.503327369689941, 41.225399017333984, + 6.654552936553955, 85.79743957519531, 89.91349029541016, + 53.55647277832031, 39.48537063598633, 3.9460408687591553 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 12302.474609375, 22772.77734375, 26919.09765625, 11281.5068359375 + ], + 'descriptor': {'dimensions': [2, 1, 2, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + reductionOperatorsTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getReductionOperatorsPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/relu.https.any.js b/webnn/conformance_tests/relu.https.any.js index 458cd61d82c184..fb4726b4b3e9fc 100644 --- a/webnn/conformance_tests/relu.https.any.js +++ b/webnn/conformance_tests/relu.https.any.js @@ -8,6 +8,364 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-relu +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-relu-method +// Compute the rectified linear function of the input tensor. +// +// MLOperand relu(MLOperand input); -runWebNNConformanceTests('relu', buildOperationWithSingleInput); + +const getReluPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const reluTests = [ + { + 'name': 'relu float32 1D constant tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'relu float32 1D tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'relu float32 2D tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'relu float32 3D tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'relu float32 4D tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'relu float32 5D tensor', + 'graph': { + 'inputs': { + 'reluInput': { + 'data': [ + 79.04724884033203, 2.2503609657287598, 80.73938751220703, + 63.9039192199707, 77.67340850830078, -71.0915756225586, + -82.74703216552734, -26.81442642211914, -99.16788482666016, + -35.71083450317383, 18.361658096313477, -37.36091613769531, + -52.8386116027832, -10.408374786376953, 60.6029167175293, + -13.64419937133789, -76.5425033569336, -8.132338523864746, + 51.51447296142578, -51.63370132446289, -64.56800079345703, + -5.093302249908447, 15.354103088378906, 90.03858947753906 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'relu', + 'arguments': [{'input': 'reluInput'}], + 'outputs': 'reluOutput' + }], + 'expectedOutputs': { + 'reluOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + reluTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getReluPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/resample2d.https.any.js b/webnn/conformance_tests/resample2d.https.any.js index 4d68f9f51bd5e6..bedd348fe58961 100644 --- a/webnn/conformance_tests/resample2d.https.any.js +++ b/webnn/conformance_tests/resample2d.https.any.js @@ -8,6 +8,435 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-resample2d-method +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-resample2d-method +// Resample the tensor values from the source to the destination spatial +// dimensions according to the scaling factors. +// +// enum MLInterpolationMode { +// "nearest-neighbor", +// "linear" +// }; +// +// dictionary MLResample2dOptions { +// MLInterpolationMode mode = "nearest-neighbor"; +// sequence scales; +// sequence<[EnforceRange] unsigned long> sizes; +// sequence<[EnforceRange] unsigned long> axes; +// }; +// +// MLOperand resample2d( +// MLOperand input, optional MLResample2dOptions options = {}); -runWebNNConformanceTests('resample2d', buildOperationWithSingleInput); + +const getResample2dPrecisionTolerance = (graphResources) => { + const args = graphResources.operators[0].arguments; + const options = + args.length === 2 ? {...args[1][Object.keys(args[1])[0]]} : {}; + const expectedOutputs = graphResources.expectedOutputs; + const dataType = + expectedOutputs[Object.keys(expectedOutputs)[0]].descriptor.dataType; + let tolerance; + + if (options.mode && options.mode === 'linear') { + // interpolation mode is linear + if (dataType === 'float32') { + tolerance = 84; + } else if (dataType === 'float16') { + tolerance = 10; + } else { + tolerance = 1; + } + } else { + // interpolation mode is nearest-neighbor + tolerance = 0; + } + + return {metricType: 'ULP', value: tolerance}; +}; + +const resample2dTests = [ + { + 'name': 'resample2d float32 4D tensor default options', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 3.8600528240203857, 45.18463134765625, 87.67153930664062, + 98.7821044921875, 66.3741455078125, 3.411583423614502, + 86.14930725097656, 95.98133850097656, 76.87126159667969, + 16.52591323852539, 65.98783111572266, 25.470922470092773, + 22.56010627746582, 92.08479309082031, 85.80876922607422, + 92.63166046142578, 29.916208267211914, 75.40460968017578, + 62.06375503540039, 1.7712159156799316, 99.4723129272461, + 11.440549850463867, 25.396343231201172, 67.0217514038086 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [{'input': 'resample2dInput'}], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 3.8600528240203857, 45.18463134765625, 87.67153930664062, + 98.7821044921875, 66.3741455078125, 3.411583423614502, + 86.14930725097656, 95.98133850097656, 76.87126159667969, + 16.52591323852539, 65.98783111572266, 25.470922470092773, + 22.56010627746582, 92.08479309082031, 85.80876922607422, + 92.63166046142578, 29.916208267211914, 75.40460968017578, + 62.06375503540039, 1.7712159156799316, 99.4723129272461, + 11.440549850463867, 25.396343231201172, 67.0217514038086 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'resample2d(upsample) float32 4D tensor options.scales', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': + [{'input': 'resample2dInput'}, {'options': {'scales': [2, 2]}}], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'resample2d(upsample) float32 4D tensor options.sizes', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': + [{'input': 'resample2dInput'}, {'options': {'sizes': [4, 6]}}], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor options.sizes ignored options.scales', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'scales': [0.5, 0.5], 'sizes': [4, 6]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'resample2d(upsample) float32 4D tensor options.axes=[1, 2]', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'sizes': [4, 6], 'axes': [1, 2]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor explicit options.axes=[2, 3]', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'sizes': [4, 6], 'axes': [2, 3]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor explicit options.mode=\'nearest-neighbor\'', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'mode': 'nearest-neighbor', 'sizes': [4, 6]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 59.92947006225586, 59.92947006225586, 41.98918914794922, + 41.98918914794922, 66.39534759521484, 66.39534759521484, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281, + 90.7006607055664, 90.7006607055664, 86.95105743408203, + 86.95105743408203, 79.10005187988281, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor options.scales options.mode=\'linear\'', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'mode': 'linear', 'scales': [2, 2]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 55.444400787353516, 46.47425842285156, + 48.090728759765625, 60.29380798339844, 66.39534759521484, + 67.62226867675781, 64.02411651611328, 56.82780838012695, + 57.31512451171875, 65.48605346679688, 69.57152557373047, + 83.00786590576172, 81.18354797363281, 77.534912109375, + 75.76390838623047, 75.87055206298828, 75.92387390136719, + 90.7006607055664, 89.76325988769531, 87.88845825195312, + 84.9883041381836, 81.06280517578125, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor options.sizes options.mode=\'linear\'', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'mode': 'linear', 'sizes': [4, 6]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 55.444400787353516, 46.47425842285156, + 48.090728759765625, 60.29380798339844, 66.39534759521484, + 67.62226867675781, 64.02411651611328, 56.82780838012695, + 57.31512451171875, 65.48605346679688, 69.57152557373047, + 83.00786590576172, 81.18354797363281, 77.534912109375, + 75.76390838623047, 75.87055206298828, 75.92387390136719, + 90.7006607055664, 89.76325988769531, 87.88845825195312, + 84.9883041381836, 81.06280517578125, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 1, 4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'resample2d(upsample) float32 4D tensor options.axes=[1, 2] options.mode=\'linear\'', + 'graph': { + 'inputs': { + 'resample2dInput': { + 'data': [ + 59.92947006225586, 41.98918914794922, 66.39534759521484, + 90.7006607055664, 86.95105743408203, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 2, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'resample2d', + 'arguments': [ + {'input': 'resample2dInput'}, + {'options': {'mode': 'linear', 'sizes': [4, 6], 'axes': [1, 2]}} + ], + 'outputs': 'resample2dOutput' + }], + 'expectedOutputs': { + 'resample2dOutput': { + 'data': [ + 59.92947006225586, 55.444400787353516, 46.47425842285156, + 48.090728759765625, 60.29380798339844, 66.39534759521484, + 67.62226867675781, 64.02411651611328, 56.82780838012695, + 57.31512451171875, 65.48605346679688, 69.57152557373047, + 83.00786590576172, 81.18354797363281, 77.534912109375, + 75.76390838623047, 75.87055206298828, 75.92387390136719, + 90.7006607055664, 89.76325988769531, 87.88845825195312, + 84.9883041381836, 81.06280517578125, 79.10005187988281 + ], + 'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + resample2dTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getResample2dPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/reshape.https.any.js b/webnn/conformance_tests/reshape.https.any.js index de9953e6f82035..212e93575bc046 100644 --- a/webnn/conformance_tests/reshape.https.any.js +++ b/webnn/conformance_tests/reshape.https.any.js @@ -8,6 +8,1284 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-reshape +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-reshape-method +// Alter the shape of a tensor to a new shape. +// +// MLOperand reshape( +// MLOperand input, sequence<[EnforceRange] unsigned long> newShape); -runWebNNConformanceTests('reshape', buildReshape); + +const getReshapePrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const reshapeTests = [ + { + 'name': 'reshape float32 tensor to a new shape (reorder all dimensions)', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 2, 3]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape float32 tensor to a new shape (reduce dimensions)', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 1, 1, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 1, 1, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 1, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape float32 tensor to a new shape (extend dimensions)', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 2, 2, 3, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape float32 tensor to a new shape (4D to 4D)', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 2, 3, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 3, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape float32 tensor to 1D tensor', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [3, 2, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 2D tensor by eliminating one dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 3D tensor by eliminating one dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 3D tensor by eliminating two dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 4D tensor by eliminating two dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 1, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 4D tensor by eliminating all dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + 'data': [-33.82555389404297], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': []}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + 'data': [-33.82555389404297], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (squeeze) float32 5D tensor by eliminating four dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (squeeze) float32 2D tensor by eliminating 1st dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (squeeze) float32 3D tensor by eliminating 2nd and 3rd dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (squeeze) float32 4D tensor by eliminating 1st and 4th dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (squeeze) float32 5D tensor by eliminating 2nd and 3rd dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 1, 12, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 12, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (squeeze) float32 5D tensor by eliminating 1st, 2nd and 5th dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 0D tensor to 4D', + 'graph': { + 'inputs': { + 'reshapeInput': { + 'data': [-33.82555389404297], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 1, 1, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + 'data': [-33.82555389404297], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 1D tensor by adding one dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 1D tensor by adding two dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 1D tensor to 5D', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': + [{'input': 'reshapeInput'}, {'newShape': [1, 1, 1, 24, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 1, 24, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (unsqueeze) float32 1D tensor by adding 2nd and 3rd dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24, 1, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 2D tensor by adding one dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 1, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 1, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 2D tensor by adding two dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 4, 1, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 1, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 2D tensor by adding 1st dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (unsqueeze) float32 2D tensor by adding 1st and 4th dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 4, 6, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 4, 6, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'reshape (unsqueeze) float32 3D tensor by adding 2nd and 3rd dimensions', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': + [{'input': 'reshapeInput'}, {'newShape': [2, 1, 1, 12, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 1, 12, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 4D tensor by adding 2nd dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 1, 2, 2, 3]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (unsqueeze) float32 5D tensor by adding 4th dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 3, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': + [{'input': 'reshapeInput'}, {'newShape': [2, 1, 4, 1, 3, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': + {'dimensions': [2, 1, 4, 1, 3, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (flatten) float32 3D tensor to 2D', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [2, 12]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (flatten) float32 4D to 2D', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [4, 6]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (flatten) float32 4D to 2D exclusive 1st dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [1, 24]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'reshape (flatten) float32 4D to 2D exclusive 4th dimension', + 'graph': { + 'inputs': { + 'reshapeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'reshape', + 'arguments': [{'input': 'reshapeInput'}, {'newShape': [24, 1]}], + 'outputs': 'reshapeOutput' + }], + 'expectedOutputs': { + 'reshapeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + reshapeTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getReshapePrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/sigmoid.https.any.js b/webnn/conformance_tests/sigmoid.https.any.js index 154e68e4299947..1aba9bbb10bcdd 100644 --- a/webnn/conformance_tests/sigmoid.https.any.js +++ b/webnn/conformance_tests/sigmoid.https.any.js @@ -8,6 +8,270 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-sigmoid +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-sigmoid-method +// Compute the sigmoid function of the input tensor. The calculation follows the +// expression 1 / (exp(-x) + 1). +// +// MLOperand sigmoid(MLOperand input); -runWebNNConformanceTests('sigmoid', buildOperationWithSingleInput); + +const getSigmoidPrecisionTolerance = (graphResources) => { + // float32 (leaving a few ULP for roundoff) + const toleranceValueDict = {float32: 32 + 2, float16: 3}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const sigmoidTests = [ + { + 'name': 'sigmoid float32 1D constant tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sigmoid float32 1D tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sigmoid float32 2D tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sigmoid float32 3D tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sigmoid float32 4D tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sigmoid float32 5D tensor', + 'graph': { + 'inputs': { + 'sigmoidInput': { + 'data': [ + -0.37699514627456665, -0.6848450899124146, -5.988872051239014, + 4.431885719299316, -0.93868488073349, 4.591195583343506, + -2.5067026615142822, 1.5669522285461426, -2.596473217010498, + -3.64729380607605, 2.6785237789154053, -3.1051602363586426, + 2.2585017681121826, -0.2865157723426819, 4.64043664932251, + 1.0606156587600708, -3.536252498626709, 0.4410440921783447, + 4.791460037231445, 2.0745489597320557, 0.8354471325874329, + -5.433595657348633, -4.184835910797119, -2.484982490539551 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sigmoid', + 'arguments': [{'input': 'sigmoidInput'}], + 'outputs': 'sigmoidOutput' + }], + 'expectedOutputs': { + 'sigmoidOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + sigmoidTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSigmoidPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/sin.https.any.js b/webnn/conformance_tests/sin.https.any.js new file mode 100644 index 00000000000000..30fc9a54f8f02b --- /dev/null +++ b/webnn/conformance_tests/sin.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise sin operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the sine of the input tensor, element-wise. +// +// MLOperand sin(MLOperand input); + + +const getSinPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const sinTests = [ + { + 'name': 'sin float32 0D scalar', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [79.78058624267578], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + 'data': [-0.946033775806427], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 1D constant tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 1D tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 2D tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 3D tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 4D tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sin float32 5D tensor', + 'graph': { + 'inputs': { + 'sinInput': { + 'data': [ + 79.78058624267578, 55.005733489990234, -28.052532196044922, + -31.64430046081543, 56.283756256103516, -96.18511962890625, + -72.99826049804688, -3.424182653427124, 84.02549743652344, + 5.03037166595459, -9.512612342834473, 9.540593147277832, + -25.26725196838379, -20.831640243530273, -32.02475357055664, + -55.69102478027344, 15.927481651306152, -57.8835334777832, + 31.016063690185547, -94.88304901123047, -84.58417510986328, + 44.8487434387207, -19.000272750854492, -48.03827667236328 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sin', + 'arguments': [{'input': 'sinInput'}], + 'outputs': 'sinOutput' + }], + 'expectedOutputs': { + 'sinOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + sinTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSinPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/slice.https.any.js b/webnn/conformance_tests/slice.https.any.js index b39eade98f29b9..1c53d45fd5c052 100644 --- a/webnn/conformance_tests/slice.https.any.js +++ b/webnn/conformance_tests/slice.https.any.js @@ -8,6 +8,244 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-slice +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-slice +// Produce a slice of the input tensor. +// +// MLOperand slice( +// MLOperand input, sequence<[EnforceRange] unsigned long>starts, +// sequence<[EnforceRange] unsigned long>sizes); -runWebNNConformanceTests('slice', buildSlice); + +const getSlicePrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const sliceTests = [ + { + 'name': 'slice float32 1D constant tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': + [{'input': 'sliceInput'}, {'starts': [12]}, {'sizes': [12]}], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'slice float32 1D tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': + [{'input': 'sliceInput'}, {'starts': [12]}, {'sizes': [12]}], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + '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 + ], + 'descriptor': {'dimensions': [12], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'slice float32 2D tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': + [{'input': 'sliceInput'}, {'starts': [2, 2]}, {'sizes': [2, 4]}], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + 'data': [ + 28.32765007019043, 74.02619171142578, -74.54559326171875, + -27.306041717529297, -58.46095275878906, 79.80570983886719, + -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [2, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'slice float32 3D tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [4, 3, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': [ + {'input': 'sliceInput'}, {'starts': [1, 1, 1]}, {'sizes': [3, 2, 1]} + ], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + 'data': [ + 57.4397087097168, -4.513182163238525, 74.02619171142578, + -27.306041717529297, 79.80570983886719, 42.665199279785156 + ], + 'descriptor': {'dimensions': [3, 2, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'slice float32 4D tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [2, 2, 3, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': [ + {'input': 'sliceInput'}, {'starts': [1, 0, 2, 1]}, + {'sizes': [1, 2, 1, 1]} + ], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + 'data': [-27.306041717529297, 42.665199279785156], + 'descriptor': {'dimensions': [1, 2, 1, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'slice float32 5D tensor', + 'graph': { + 'inputs': { + 'sliceInput': { + 'data': [ + 28.846250534057617, 97.95414733886719, -68.15961456298828, + 14.978987693786621, 90.23090362548828, 76.59095764160156, + -24.556316375732422, 79.58749389648438, 65.21376037597656, + 57.4397087097168, 74.41775512695312, -4.513182163238525, + 0.5424534678459167, 80.44634246826172, 28.32765007019043, + 74.02619171142578, -74.54559326171875, -27.306041717529297, + -70.42774200439453, 59.82632064819336, -58.46095275878906, + 79.80570983886719, -9.857853889465332, 42.665199279785156 + ], + 'descriptor': {'dimensions': [2, 2, 3, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'slice', + 'arguments': [ + {'input': 'sliceInput'}, {'starts': [1, 0, 2, 1, 0]}, + {'sizes': [1, 2, 1, 1, 1]} + ], + 'outputs': 'sliceOutput' + }], + 'expectedOutputs': { + 'sliceOutput': { + 'data': [-27.306041717529297, 42.665199279785156], + 'descriptor': {'dimensions': [1, 2, 1, 1, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + sliceTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSlicePrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/softmax.https.any.js b/webnn/conformance_tests/softmax.https.any.js index 20c050d7bd8e5c..28c0ff5ecac229 100644 --- a/webnn/conformance_tests/softmax.https.any.js +++ b/webnn/conformance_tests/softmax.https.any.js @@ -8,6 +8,226 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softmax +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-softmax-method +// Compute the softmax values of the N-D input tensor along the given axis. +// +// MLOperand softmax(MLOperand input, unsigned long axis); -runWebNNConformanceTests('softmax', buildSoftmax); + +const getSoftmaxPrecisionTolerance = (graphResources) => { + const args = graphResources.operators[0].arguments; + const inputShape = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const axis = args.length === 2 ? args[1][Object.keys(args[1])[0]] : 1; + const tolerance = inputShape[axis] * 3 + 3; + const toleranceValueDict = {float32: tolerance, float16: tolerance}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const softmaxTests = [ + { + 'name': 'softmax float32 2D constant tensor all positive', + 'graph': { + 'inputs': { + 'softmaxInput': { + 'data': [ + 7.9037346839904785, 6.358251571655273, 4.833756923675537, + 9.5791654586792, 0.21071857213974, 4.554958820343018, + 7.150174140930176, 8.330297470092773, 1.5359858274459839, + 6.63361930847168, 1.4539369344711304, 0.213418647646904, + 5.257819652557373, 8.192137718200684, 8.16172981262207, + 2.874434232711792, 8.950733184814453, 6.111632823944092, + 1.6371468305587769, 0.27626121044158936, 5.02822732925415, + 3.8983259201049805, 2.8967113494873047, 6.88947057723999 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'softmax', + 'arguments': [{'input': 'softmaxInput'}], + 'outputs': 'softmaxOutput' + }], + 'expectedOutputs': { + 'softmaxOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softmax float32 2D tensor all positive', + 'graph': { + 'inputs': { + 'softmaxInput': { + 'data': [ + 7.9037346839904785, 6.358251571655273, 4.833756923675537, + 9.5791654586792, 0.21071857213974, 4.554958820343018, + 7.150174140930176, 8.330297470092773, 1.5359858274459839, + 6.63361930847168, 1.4539369344711304, 0.213418647646904, + 5.257819652557373, 8.192137718200684, 8.16172981262207, + 2.874434232711792, 8.950733184814453, 6.111632823944092, + 1.6371468305587769, 0.27626121044158936, 5.02822732925415, + 3.8983259201049805, 2.8967113494873047, 6.88947057723999 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softmax', + 'arguments': [{'input': 'softmaxInput'}], + 'outputs': 'softmaxOutput' + }], + 'expectedOutputs': { + 'softmaxOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softmax float32 2D tensor all negative', + 'graph': { + 'inputs': { + 'softmaxInput': { + 'data': [ + -3.3118433952331543, -3.3389549255371094, -3.4102790355682373, + -6.697193145751953, -7.896223545074463, -3.308168888092041, + -3.2309720516204834, -4.315771579742432, -9.311088562011719, + -3.9236626625061035, -3.780721426010132, -6.034926891326904, + -3.9196677207946777, -2.2234842777252197, -9.326531410217285, + -1.4882491827011108, -6.302842617034912, -5.53147554397583, + -1.8421411514282227, -4.994808197021484, -9.527292251586914, + -4.985682964324951, -8.421041488647461, -6.235629558563232 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softmax', + 'arguments': [{'input': 'softmaxInput'}], + 'outputs': 'softmaxOutput' + }], + 'expectedOutputs': { + 'softmaxOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softmax float32 3D constant tensor', + 'graph': { + 'inputs': { + 'softmaxInput': { + 'data': [ + 0.4301910996437073, 0.5471914410591125, -1.1637765169143677, + 0.18390046060085297, 0.583903968334198, 0.17356790602207184, + 0.5397239923477173, -0.9535139799118042, -0.5920282602310181, + -0.17344485223293304, 0.14395014941692352, -0.37920907139778137 + ], + 'descriptor': {'dimensions': [1, 3, 4], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'softmax', + 'arguments': [{'input': 'softmaxInput'}, {'axis': 1}], + 'outputs': 'softmaxOutput' + }], + 'expectedOutputs': { + 'softmaxOutput': { + 'data': [ + 0.39589041471481323, 0.45983806252479553, 0.09812675416469574, + 0.529077410697937, 0.4616699814796448, 0.31647709012031555, + 0.5390242338180542, 0.16964708268642426, 0.142439603805542, + 0.22368484735488892, 0.36284899711608887, 0.3012755215167999 + ], + 'descriptor': {'dimensions': [1, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softmax float32 4D tensor', + 'graph': { + 'inputs': { + 'softmaxInput': { + 'data': [ + 0.4301910996437073, 0.5471914410591125, -1.1637765169143677, + 0.18390046060085297, 0.583903968334198, 0.17356790602207184, + 0.5397239923477173, -0.9535139799118042, -0.5920282602310181, + -0.17344485223293304, 0.14395014941692352, -0.37920907139778137 + ], + 'descriptor': {'dimensions': [3, 4, 1, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softmax', + 'arguments': [{'input': 'softmaxInput'}, {'axis': 1}], + 'outputs': 'softmaxOutput' + }], + 'expectedOutputs': { + 'softmaxOutput': { + 'data': [ + 0.3216537833213806, 0.3615773916244507, 0.06533370912075043, + 0.25143513083457947, 0.35271573066711426, 0.23400123417377472, + 0.33747196197509766, 0.07581108063459396, 0.17110128700733185, + 0.26004093885421753, 0.3571779429912567, 0.2116798311471939 + ], + 'descriptor': {'dimensions': [3, 4, 1, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + softmaxTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSoftmaxPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/softplus.https.any.js b/webnn/conformance_tests/softplus.https.any.js index a2f90bd23d5e18..9c6698e6d05df4 100644 --- a/webnn/conformance_tests/softplus.https.any.js +++ b/webnn/conformance_tests/softplus.https.any.js @@ -8,6 +8,269 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softplus +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-softplus-method +// Compute the softplus function of the input tensor. The calculation follows +// the expression ln(1 + exp(x)). +// +// MLOperand softplus(MLOperand input); -runWebNNConformanceTests('softplus', buildOperationWithSingleInput); + +const getSoftplusPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 18, float16: 18}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const softplusTests = [ + { + 'name': 'softplus float32 1D constant tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softplus float32 1D tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softplus float32 2D tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softplus float32 3D tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softplus float32 4D tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softplus float32 5D tensor', + 'graph': { + 'inputs': { + 'softplusInput': { + 'data': [ + 5.626614570617676, 5.167487144470215, 4.0146355628967285, + 9.480032920837402, 9.989937782287598, 7.065441131591797, + 2.132680892944336, 8.187150955200195, 5.169976234436035, + 2.1044998168945312, 3.523329496383667, 4.136340618133545, + 1.741871953010559, 5.145224094390869, 5.015515327453613, + 0.04590393602848053, 2.957089900970459, 3.959244728088379, + 5.517927169799805, 7.192322254180908, 8.764925003051758, + 1.373470425605774, 8.930668830871582, 8.660283088684082 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softplus', + 'arguments': [{'input': 'softplusInput'}], + 'outputs': 'softplusOutput' + }], + 'expectedOutputs': { + 'softplusOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + softplusTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSoftplusPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/softsign.https.any.js b/webnn/conformance_tests/softsign.https.any.js index 1e9c9f77fee338..b146953bb61684 100644 --- a/webnn/conformance_tests/softsign.https.any.js +++ b/webnn/conformance_tests/softsign.https.any.js @@ -8,6 +8,309 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-softsign +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-softsign-method +// Compute the softsign function of the input tensor. The calculation follows +// the expression x / (1 + |x|). +// +// MLOperand softsign(MLOperand input); -runWebNNConformanceTests('softsign', buildOperationWithSingleInput); + +const getSoftsignPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 3, float16: 3}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const softsignTests = [ + { + 'name': 'softsign positive float32 1D constant tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + 1.5834133625030518, 4.078719139099121, 8.883357048034668, + 8.070859909057617, 8.211773872375488, 2.4554004669189453, + 0.653374195098877, 7.866281032562256, 3.123955249786377, + 8.013792037963867, 3.940986156463623, 1.813172698020935, + 2.3906760215759277, 1.335968017578125, 9.416410446166992, + 0.4432569146156311, 5.236661911010742, 9.42424201965332, + 7.816190242767334, 5.849185943603516, 8.780370712280273, + 5.120515823364258, 7.117222309112549, 4.599106788635254 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign positive float32 1D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + 1.5834133625030518, 4.078719139099121, 8.883357048034668, + 8.070859909057617, 8.211773872375488, 2.4554004669189453, + 0.653374195098877, 7.866281032562256, 3.123955249786377, + 8.013792037963867, 3.940986156463623, 1.813172698020935, + 2.3906760215759277, 1.335968017578125, 9.416410446166992, + 0.4432569146156311, 5.236661911010742, 9.42424201965332, + 7.816190242767334, 5.849185943603516, 8.780370712280273, + 5.120515823364258, 7.117222309112549, 4.599106788635254 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign negative float32 1D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + -2.597844123840332, -0.4449555575847626, -9.095475196838379, + -3.7480077743530273, -1.3867290019989014, -8.220329284667969, + -3.538342237472534, -9.364588737487793, -6.283252239227295, + -5.002012252807617, -8.245729446411133, -3.775470495223999, + -4.087255001068115, -7.381676197052002, -5.8829216957092285, + -8.338910102844238, -6.60154914855957, -4.491941928863525, + -3.5247786045074463, -4.43991231918335, -5.234262466430664, + -1.5911732912063599, -9.106277465820312, -8.523774147033691 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign float32 2D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + -8.343496322631836, -6.920152187347412, 2.699638843536377, + -8.663105010986328, -3.1905343532562256, 7.657886981964111, + 6.650215148925781, 6.058011054992676, 0.6634320616722107, + 5.8058037757873535, -0.32821124792099, 1.2704304456710815, + -9.946120262145996, 6.905375003814697, -0.031071536242961884, + -3.9696409702301025, 6.270823001861572, -2.639260768890381, + 3.0513505935668945, 7.426476955413818, -8.454667091369629, + 7.135868072509766, -4.986093997955322, -7.859614849090576 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign float32 3D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + -8.343496322631836, -6.920152187347412, 2.699638843536377, + -8.663105010986328, -3.1905343532562256, 7.657886981964111, + 6.650215148925781, 6.058011054992676, 0.6634320616722107, + 5.8058037757873535, -0.32821124792099, 1.2704304456710815, + -9.946120262145996, 6.905375003814697, -0.031071536242961884, + -3.9696409702301025, 6.270823001861572, -2.639260768890381, + 3.0513505935668945, 7.426476955413818, -8.454667091369629, + 7.135868072509766, -4.986093997955322, -7.859614849090576 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign float32 4D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + -8.343496322631836, -6.920152187347412, 2.699638843536377, + -8.663105010986328, -3.1905343532562256, 7.657886981964111, + 6.650215148925781, 6.058011054992676, 0.6634320616722107, + 5.8058037757873535, -0.32821124792099, 1.2704304456710815, + -9.946120262145996, 6.905375003814697, -0.031071536242961884, + -3.9696409702301025, 6.270823001861572, -2.639260768890381, + 3.0513505935668945, 7.426476955413818, -8.454667091369629, + 7.135868072509766, -4.986093997955322, -7.859614849090576 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'softsign float32 5D tensor', + 'graph': { + 'inputs': { + 'softsignInput': { + 'data': [ + -8.343496322631836, -6.920152187347412, 2.699638843536377, + -8.663105010986328, -3.1905343532562256, 7.657886981964111, + 6.650215148925781, 6.058011054992676, 0.6634320616722107, + 5.8058037757873535, -0.32821124792099, 1.2704304456710815, + -9.946120262145996, 6.905375003814697, -0.031071536242961884, + -3.9696409702301025, 6.270823001861572, -2.639260768890381, + 3.0513505935668945, 7.426476955413818, -8.454667091369629, + 7.135868072509766, -4.986093997955322, -7.859614849090576 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'softsign', + 'arguments': [{'input': 'softsignInput'}], + 'outputs': 'softsignOutput' + }], + 'expectedOutputs': { + 'softsignOutput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + softsignTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSoftsignPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/split.https.any.js b/webnn/conformance_tests/split.https.any.js index 84fee2f66512a5..eee757f29766df 100644 --- a/webnn/conformance_tests/split.https.any.js +++ b/webnn/conformance_tests/split.https.any.js @@ -8,6 +8,515 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-split +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-split +// Split the input tensor into a number of sub tensors along the given axis. +// +// dictionary MLSplitOptions { +// [EnforceRange] unsigned long axis = 0; +// }; +// +// sequence split( +// MLOperand input, +// ([EnforceRange] unsigned long or sequence<[EnforceRange] unsigned long>) +// splits, optional MLSplitOptions options = {}); -runWebNNConformanceTests('split', buildSplit); + +const getSplitPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const dataType = + graphResources + .expectedOutputs[Object.keys(graphResources.expectedOutputs)[0]] + .descriptor.dataType; + return {metricType: 'ULP', value: toleranceValueDict[dataType]}; +}; + +const splitTests = [ + { + 'name': 'split float32 1D constant tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 3}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258, + -68.11224365234375, 75.99607849121094 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -61.05668640136719, -90.92643737792969, 53.916622161865234, + 84.16268920898438, -95.57494354248047, -52.40757751464844, + -29.007186889648438, 71.65496063232422 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'splitOutput3': { + 'data': [ + 50.66357421875, 21.364582061767578, -27.127241134643555, + 65.1489486694336, -30.40681266784668, -6.818390369415283, + 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 1D tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 3}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258, + -68.11224365234375, 75.99607849121094 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -61.05668640136719, -90.92643737792969, 53.916622161865234, + 84.16268920898438, -95.57494354248047, -52.40757751464844, + -29.007186889648438, 71.65496063232422 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + }, + 'splitOutput3': { + 'data': [ + 50.66357421875, 21.364582061767578, -27.127241134643555, + 65.1489486694336, -30.40681266784668, -6.818390369415283, + 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [8], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 2D tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [8, 3], 'dataType': 'float32'} + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 2}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + '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 + ], + 'descriptor': {'dimensions': [4, 3], 'dataType': 'float32'} + }, + 'splitOutput2': { + '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 + ], + 'descriptor': {'dimensions': [4, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 3D tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [4, 3, 2], 'dataType': 'float32'} + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 2}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 4D tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [12, 1, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 4}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -68.11224365234375, 75.99607849121094, -61.05668640136719, + -90.92643737792969, 53.916622161865234, 84.16268920898438 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput3': { + 'data': [ + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput4': { + 'data': [ + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 5D tensor number splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [6, 1, 1, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [ + {'name': 'split', 'arguments': [{'input': 'splitInput'}, {'splits': 2}]} + ], + 'expectedOutputs': { + 'splitOutput1': { + '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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + '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 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 4D tensor array splits default options', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [12, 1, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'split', + 'arguments': [{'input': 'splitInput'}, {'splits': [3, 3, 3, 3]}] + }], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -68.11224365234375, 75.99607849121094, -61.05668640136719, + -90.92643737792969, 53.916622161865234, 84.16268920898438 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput3': { + 'data': [ + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput4': { + 'data': [ + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [3, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 4D tensor number splits options.axis', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [12, 1, 1, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'split', + 'arguments': + [{'input': 'splitInput'}, {'splits': 3}, {'options': {'axis': 0}}] + }], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258, + -68.11224365234375, 75.99607849121094 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -61.05668640136719, -90.92643737792969, 53.916622161865234, + 84.16268920898438, -95.57494354248047, -52.40757751464844, + -29.007186889648438, 71.65496063232422 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2], 'dataType': 'float32'} + }, + 'splitOutput3': { + 'data': [ + 50.66357421875, 21.364582061767578, -27.127241134643555, + 65.1489486694336, -30.40681266784668, -6.818390369415283, + 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 5D tensor array splits=[3, 3] options.axis=2', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [1, 1, 6, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'split', + 'arguments': [ + {'input': 'splitInput'}, {'splits': [3, 3]}, {'options': {'axis': 2}} + ] + }], + 'expectedOutputs': { + 'splitOutput1': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 3, 2, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + '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 + ], + 'descriptor': {'dimensions': [1, 1, 3, 2, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'split float32 5D tensor array splits=[2, 4] options.axis=0', + 'graph': { + 'inputs': { + 'splitInput': { + '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, + -95.57494354248047, -52.40757751464844, -29.007186889648438, + 71.65496063232422, 50.66357421875, 21.364582061767578, + -27.127241134643555, 65.1489486694336, -30.40681266784668, + -6.818390369415283, 46.673622131347656, -21.12453842163086 + ], + 'descriptor': {'dimensions': [6, 1, 1, 2, 2], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'split', + 'arguments': [ + {'input': 'splitInput'}, {'splits': [2, 4]}, {'options': {'axis': 0}} + ] + }], + 'expectedOutputs': { + 'splitOutput1': { + 'data': [ + -64.52056884765625, -84.60513305664062, -67.99282836914062, + -23.446075439453125, -85.64382934570312, 46.87752151489258, + -68.11224365234375, 75.99607849121094 + ], + 'descriptor': {'dimensions': [2, 1, 1, 2, 2], 'dataType': 'float32'} + }, + 'splitOutput2': { + 'data': [ + -61.05668640136719, -90.92643737792969, 53.916622161865234, + 84.16268920898438, -95.57494354248047, -52.40757751464844, + -29.007186889648438, 71.65496063232422, 50.66357421875, + 21.364582061767578, -27.127241134643555, 65.1489486694336, + -30.40681266784668, -6.818390369415283, 46.673622131347656, + -21.12453842163086 + ], + 'descriptor': {'dimensions': [4, 1, 1, 2, 2], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + splitTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSplitPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/sqrt.https.any.js b/webnn/conformance_tests/sqrt.https.any.js new file mode 100644 index 00000000000000..aa24dc5501f3fd --- /dev/null +++ b/webnn/conformance_tests/sqrt.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise sqrt operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the square root of the input tensor, element-wise. +// +// MLOperand sqrt(MLOperand input); + + +const getSqrtPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const sqrtTests = [ + { + 'name': 'sqrt float32 0D scalar', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [4.0044636726379395], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + 'data': [2.001115560531616], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 1D constant tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 1D tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 2D tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 3D tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 4D tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sqrt float32 5D tensor', + 'graph': { + 'inputs': { + 'sqrtInput': { + 'data': [ + 7.256007194519043, 7.786442279815674, 1.3684587478637695, + 8.05341625213623, 9.131288528442383, 8.52578067779541, + 4.870553493499756, 7.625959396362305, 2.705026865005493, + 8.709602355957031, 3.2687935829162598, 4.712882995605469, + 8.669181823730469, 8.829607009887695, 0.5529024600982666, + 7.958771228790283, 4.09640645980835, 7.919884204864502, + 4.424484729766846, 0.09894099831581116, 4.6900248527526855, + 1.5277378559112549, 5.929779529571533, 6.066471576690674 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sqrt', + 'arguments': [{'input': 'sqrtInput'}], + 'outputs': 'sqrtOutput' + }], + 'expectedOutputs': { + 'sqrtOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + sqrtTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSqrtPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/sub.https.any.js b/webnn/conformance_tests/sub.https.any.js index 367780e1147f9b..c034cf7b0ada38 100644 --- a/webnn/conformance_tests/sub.https.any.js +++ b/webnn/conformance_tests/sub.https.any.js @@ -1,4 +1,4 @@ -// META: title=test WebNN API element-wise binary operations +// META: title=test WebNN API element-wise sub operation // META: global=window,dedicatedworker // META: variant=?cpu // META: variant=?gpu @@ -8,6 +8,528 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-binary +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary +// Compute the element-wise binary subtraction of the two input tensors. +// MLOperand sub(MLOperand a, MLOperand b); -runWebNNConformanceTests('sub', buildOperationWithTwoInputs); + +const getSubPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1, float16: 1}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const subTests = [ + { + 'name': 'sub float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 1D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 2D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 3D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 4D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 5D tensors', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -49.12813186645508, 40.189292907714844, 7.224666595458984, + 89.26004791259766, -81.43340301513672, 59.61166000366211, + 11.234410285949707, 48.884056091308594, 85.26825714111328, + 27.695297241210938, 30.98945426940918, -38.12903594970703, + -83.14810180664062, -86.16175079345703, 16.75888442993164, + 46.12889862060547, -28.432477951049805, 28.229337692260742, + 35.2364616394043, -77.05516815185547, -57.8714714050293, + -58.15085983276367, 27.488866806030273, 31.99802017211914 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 broadcast 1D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-97.04911804199219], + 'descriptor': {'dimensions': [1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 broadcast 2D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 10.762838363647461, -90.23992156982422, 12.787367820739746, + -62.44633865356445, 32.18257522583008, 20.359493255615234 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 broadcast 3D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + -8.39311408996582, 75.54753112792969, -32.325870513916016, + 8.088332176208496 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'sub float32 broadcast 4D to 4D', + 'graph': { + 'inputs': { + 'inputA': { + 'data': [-97.04911804199219], + 'descriptor': {'dimensions': [1, 1, 1, 1], 'dataType': 'float32'} + }, + 'inputB': { + 'data': [ + 73.59273529052734, 14.4846830368042, -69.40201568603516, + -52.045284271240234, -75.7813720703125, -2.2740514278411865, + -83.29907989501953, 15.57776927947998, -62.7008056640625, + 32.954002380371094, 82.55709075927734, -74.90638732910156, + 78.22299194335938, 48.39240264892578, -19.153541564941406, + -85.93221282958984, 89.12355041503906, 22.874629974365234, + 80.56973266601562, 97.62598419189453, 52.74850845336914, + 89.1660385131836, -20.50341796875, 99.48707580566406 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'sub', + 'arguments': [{'a': 'inputA'}, {'b': 'inputB'}], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'output': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + subTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getSubPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/tan.https.any.js b/webnn/conformance_tests/tan.https.any.js new file mode 100644 index 00000000000000..5fcf0e68996855 --- /dev/null +++ b/webnn/conformance_tests/tan.https.any.js @@ -0,0 +1,297 @@ +// META: title=test WebNN API element-wise tan operation +// META: global=window,dedicatedworker +// META: variant=?cpu +// META: variant=?gpu +// META: variant=?npu +// META: script=../resources/utils.js +// META: timeout=long + +'use strict'; + +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-unary +// Compute the tangent of the input tensor, element-wise. +// +// MLOperand tan(MLOperand input); + + +const getTanPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const tanTests = [ + { + 'name': 'tan float32 0D scalar', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [52.69781494140625], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + 'data': [-0.8582430481910706], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 1D constant tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 1D tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 2D tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 3D tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 4D tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tan float32 5D tensor', + 'graph': { + 'inputs': { + 'tanInput': { + 'data': [ + 52.69781494140625, 70.06912994384766, 90.49689483642578, + 24.65666961669922, 11.66512680053711, -50.95264434814453, + 40.320064544677734, -9.641122817993164, -31.567750930786133, + 45.59520721435547, -55.93085861206055, -44.602970123291016, + 80.4539794921875, -2.314880847930908, -25.474767684936523, + 62.589454650878906, -70.94403076171875, 62.84861755371094, + 84.79766845703125, -95.58502960205078, 15.552484512329102, + -55.25654220581055, -26.884889602661133, 0.159261092543602 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tan', + 'arguments': [{'input': 'tanInput'}], + 'outputs': 'tanOutput' + }], + 'expectedOutputs': { + 'tanOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + tanTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getTanPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/tanh.https.any.js b/webnn/conformance_tests/tanh.https.any.js index d7d1b597518909..8fc7317a2cf566 100644 --- a/webnn/conformance_tests/tanh.https.any.js +++ b/webnn/conformance_tests/tanh.https.any.js @@ -8,6 +8,269 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-tanh +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-tanh-method +// Compute the hyperbolic tangent function of the input tensor. The calculation +// follows the expression (exp(2 * x) - 1) / (exp(2 * x) + 1). +// +// MLOperand tanh(MLOperand input); -runWebNNConformanceTests('tanh', buildOperationWithSingleInput); + +const getTanhPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 1 / 1024, float16: 1 / 512}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ATOL', value: toleranceValueDict[expectedDataType]}; +}; + +const tanhTests = [ + { + 'name': 'tanh float32 1D constant tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tanh float32 1D tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tanh float32 2D tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tanh float32 3D tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tanh float32 4D tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'tanh float32 5D tensor', + 'graph': { + 'inputs': { + 'tanhInput': { + 'data': [ + 5.473527431488037, -1.1535595655441284, 0.4074455797672272, + 1.8297704458236694, 2.869000196456909, -4.570195198059082, + 4.146744251251221, -4.065934181213379, -3.7128469944000244, + 0.9077175259590149, -0.11083049327135086, 5.955096244812012, + 1.7831857204437256, 4.023128509521484, 5.587857723236084, + -5.280653953552246, 1.4147950410842896, -5.707716941833496, + -1.443918228149414, -1.9129083156585693, 2.7495968341827393, + -0.7420240044593811, 4.856568336486816, -0.7563357949256897 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'tanh', + 'arguments': [{'input': 'tanhInput'}], + 'outputs': 'tanhOutput' + }], + 'expectedOutputs': { + 'tanhOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + tanhTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getTanhPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/transpose.https.any.js b/webnn/conformance_tests/transpose.https.any.js index 82abef96ea2f66..61f043a9b0fcef 100644 --- a/webnn/conformance_tests/transpose.https.any.js +++ b/webnn/conformance_tests/transpose.https.any.js @@ -8,6 +8,484 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-transpose +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-transpose +// Permute the dimensions of the input tensor according to the permutation +// argument. +// +// dictionary MLTransposeOptions { +// sequence<[EnforceRange] unsigned long> permutation; +// }; +// +// MLOperand transpose( +// MLOperand input, optional MLTransposeOptions options = {}); -runWebNNConformanceTests('transpose', buildOperationWithSingleInput); + +const getTransposePrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const transposeTests = [ + { + 'name': 'transpose float32 1D constant tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 1D tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 2D tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [6, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 3D tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 3, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 4D tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 3, 2, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 5D tensor default options', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [{'input': 'transposeInput'}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 3, 1, 2, 1], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 1D tensor options.permutation', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': + [{'input': 'transposeInput'}, {'options': {'permutation': [0]}}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 2D tensor options.permutation', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': + [{'input': 'transposeInput'}, {'options': {'permutation': [1, 0]}}], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [6, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 3D tensor options.permutation', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [ + {'input': 'transposeInput'}, {'options': {'permutation': [2, 0, 1]}} + ], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 4D tensor options.permutation', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [ + {'input': 'transposeInput'}, + {'options': {'permutation': [2, 3, 0, 1]}} + ], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [3, 4, 1, 2], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'transpose float32 5D tensor options.permutation', + 'graph': { + 'inputs': { + 'transposeInput': { + '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 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'transpose', + 'arguments': [ + {'input': 'transposeInput'}, + {'options': {'permutation': [1, 3, 0, 4, 2]}} + ], + 'outputs': 'transposeOutput' + }], + 'expectedOutputs': { + 'transposeOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 1, 4, 1], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + transposeTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getTransposePrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/triangular.https.any.js b/webnn/conformance_tests/triangular.https.any.js index 9919110e9b1941..7c79518d43f951 100644 --- a/webnn/conformance_tests/triangular.https.any.js +++ b/webnn/conformance_tests/triangular.https.any.js @@ -8,6 +8,779 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-triangular +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-triangular +// Given a 2-D tensor (matrix), return a 2-D tensor containing either the upper +// or lower triangular part of the input tensor. If the input tensor has greater +// than 2 dimensions it is treated as a batch of matrices and the result has the +// same shape. +// +// dictionary MLTriangularOptions { +// boolean upper = true; +// [EnforceRange] long diagonal = 0; +// }; +// +// MLOperand triangular( +// MLOperand input, optional MLTriangularOptions options = {}); -runWebNNConformanceTests('triangular', buildOperationWithSingleInput); + +const getTriangularPrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const triangularTests = [ + { + 'name': 'triangular float32 2D tensor default options', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [{'input': 'triangularInput'}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, + -86.21631622314453, + 50.38116455078125, + -98.47772216796875, + -94.51172637939453, + -21.42218589782715, + 0, + -50.355342864990234, + -37.015724182128906, + 97.25071716308594, + 73.36241149902344, + -75.12358856201172, + 0, + 0, + -29.916187286376953, + 67.48285675048828, + 42.132598876953125, + -70.27587127685547, + 0, + 0, + 0, + -88.97057342529297, + 77.58269500732422, + 91.03327178955078 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 3D tensor default options', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [{'input': 'triangularInput'}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, + -86.21631622314453, + 50.38116455078125, + -98.47772216796875, + 0, + -21.42218589782715, + 24.678754806518555, + -50.355342864990234, + 0, + 0, + 73.36241149902344, + -75.12358856201172, + 41.64348602294922, + 58.862911224365234, + -29.916187286376953, + 67.48285675048828, + 0, + -70.27587127685547, + 20.88446617126465, + 71.37139892578125, + 0, + 0, + 77.58269500732422, + 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor default options', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [{'input': 'triangularInput'}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, + 50.38116455078125, 0, + -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, + -37.015724182128906, 0, + 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, + -29.916187286376953, 0, + 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, + -84.96932220458984, 0, + 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 5D tensor default options', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [{'input': 'triangularInput'}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 1, 4, 1, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor explict options.upper=true', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'upper': true}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, + 50.38116455078125, 0, + -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, + -37.015724182128906, 0, + 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, + -29.916187286376953, 0, + 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, + -84.96932220458984, 0, + 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor options.upper=false', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'upper': false}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, + 0, + 0, + -98.47772216796875, + -94.51172637939453, + 0, + 24.678754806518555, + 0, + 0, + 97.25071716308594, + 73.36241149902344, + 0, + 41.64348602294922, + 0, + 0, + 67.48285675048828, + 42.132598876953125, + 0, + 20.88446617126465, + 0, + 0, + -88.97057342529297, + 77.58269500732422, + 0 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor explict options.diagonal=0', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'diagonal': 0}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, + 50.38116455078125, 0, + -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, + -37.015724182128906, 0, + 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, + -29.916187286376953, 0, + 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, + -84.96932220458984, 0, + 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor options.diagonal=1', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'diagonal': 1}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 0, + -86.21631622314453, + 50.38116455078125, + 0, + 0, + -21.42218589782715, + 0, + -50.355342864990234, + -37.015724182128906, + 0, + 0, + -75.12358856201172, + 0, + 58.862911224365234, + -29.916187286376953, + 0, + 0, + -70.27587127685547, + 0, + 71.37139892578125, + -84.96932220458984, + 0, + 0, + 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor options.diagonal=-1', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'diagonal': -1}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor fully zero options.diagonal=3', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'diagonal': 3}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'triangular float32 4D tensor fully copied options.diagonal=-2', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': + [{'input': 'triangularInput'}, {'options': {'diagonal': -2}}], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'triangular float32 4D tensor options.upper=true options.diagonal=1', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [ + {'input': 'triangularInput'}, + {'options': {'upper': true, 'diagonal': 1}} + ], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 0, + -86.21631622314453, + 50.38116455078125, + 0, + 0, + -21.42218589782715, + 0, + -50.355342864990234, + -37.015724182128906, + 0, + 0, + -75.12358856201172, + 0, + 58.862911224365234, + -29.916187286376953, + 0, + 0, + -70.27587127685547, + 0, + 71.37139892578125, + -84.96932220458984, + 0, + 0, + 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'triangular float32 4D tensor options.upper=false options.diagonal=1', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [ + {'input': 'triangularInput'}, + {'options': {'upper': false, 'diagonal': 1}} + ], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 0, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, 0, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, 0, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, 0, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'triangular float32 4D tensor options.upper=false options.diagonal=-1', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [ + {'input': 'triangularInput'}, + {'options': {'upper': false, 'diagonal': -1}} + ], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 0, 0, 0, -98.47772216796875, 0, 0, + 0, 0, 0, 97.25071716308594, 0, 0, + 0, 0, 0, 67.48285675048828, 0, 0, + 0, 0, 0, -88.97057342529297, 0, 0 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'triangular float32 4D tensor fully copied options.upper=false options.diagonal=3', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [ + {'input': 'triangularInput'}, + {'options': {'upper': false, 'diagonal': 3}} + ], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': + 'triangular float32 4D tensor fully zero options.upper=false options.diagonal=-2', + 'graph': { + 'inputs': { + 'triangularInput': { + 'data': [ + 84.9194564819336, -86.21631622314453, 50.38116455078125, + -98.47772216796875, -94.51172637939453, -21.42218589782715, + 24.678754806518555, -50.355342864990234, -37.015724182128906, + 97.25071716308594, 73.36241149902344, -75.12358856201172, + 41.64348602294922, 58.862911224365234, -29.916187286376953, + 67.48285675048828, 42.132598876953125, -70.27587127685547, + 20.88446617126465, 71.37139892578125, -84.96932220458984, + -88.97057342529297, 77.58269500732422, 91.03327178955078 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'triangular', + 'arguments': [ + {'input': 'triangularInput'}, + {'options': {'upper': false, 'diagonal': -2}} + ], + 'outputs': 'triangularOutput' + }], + 'expectedOutputs': { + 'triangularOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + triangularTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getTriangularPrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/conformance_tests/where.https.any.js b/webnn/conformance_tests/where.https.any.js index fa920ac2519dc3..957f82860839e0 100644 --- a/webnn/conformance_tests/where.https.any.js +++ b/webnn/conformance_tests/where.https.any.js @@ -8,6 +8,1019 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-where +// https://www.w3.org/TR/webnn/#api-mlgraphbuilder-where +// Select the values from the input or the other tensor depending on the +// corresponding boolean values of the condition tensor. +// +// MLOperand where(MLOperand condition, MLOperand trueValue, MLOperand +// falseValue); -runWebNNConformanceTests('where', buildWhere); + +const getWherePrecisionTolerance = (graphResources) => { + const toleranceValueDict = {float32: 0, float16: 0}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; +}; + +const whereTests = [ + { + 'name': 'where float32 0D scalars', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [247], + 'descriptor': {'dimensions': [], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + 'data': [-22.83924102783203], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + }, + 'inputFalseValue': { + 'data': [-50.02232360839844], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + 'data': [-22.83924102783203], + 'descriptor': {'dimensions': [], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 1D constant tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'}, + 'constant': true + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 1D tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [24], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 2D tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [4, 6], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 3D tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 3, 4], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 5D tensors', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 1, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast condition 0D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [247], + 'descriptor': {'dimensions': [], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast condition 1D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [253, 222, 0], + 'descriptor': {'dimensions': [3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast condition 2D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [103, 0], + 'descriptor': {'dimensions': [2, 1], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast condition 3D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [235, 0, 93, 213, 0, 117], + 'descriptor': {'dimensions': [1, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast condition 4D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [0, 165, 0, 90], + 'descriptor': {'dimensions': [1, 2, 2, 1], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast trueValues 2D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + 'data': [ + 38.77214050292969, 18.20477294921875, -11.542049407958984, + -82.74693298339844, -18.61202621459961, -75.77534484863281 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast trueValues 4D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + 'data': [ + -29.164173126220703, 32.200286865234375, -6.146966457366943, + -24.822790145874023 + ], + 'descriptor': {'dimensions': [2, 2, 1, 1], 'dataType': 'float32'} + }, + 'inputFalseValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast falseValues 3D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + 'data': [ + -86.59848022460938, -67.72773742675781, -30.731334686279297, + -93.49223327636719 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors only broadcast falseValues 4D to 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + 'data': [ + 17.777414321899414, -1.9890096187591553, -57.28207015991211, + -80.01390838623047, 66.87323760986328, -31.328258514404297 + ], + 'descriptor': {'dimensions': [1, 2, 1, 3], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + }, + { + 'name': 'where float32 4D tensors all broadcast 4D', + 'graph': { + 'inputs': { + 'inputCondition': { + 'data': [58, 217], + 'descriptor': {'dimensions': [2, 1, 1, 1], 'dataType': 'uint8'} + }, + 'inputTrueValue': { + 'data': [ + 38.77214050292969, 18.20477294921875, -11.542049407958984, + -82.74693298339844, -18.61202621459961, -75.77534484863281 + ], + 'descriptor': {'dimensions': [2, 3], 'dataType': 'float32'} + }, + 'inputFalseValue': { + 'data': [ + -86.59848022460938, -67.72773742675781, -30.731334686279297, + -93.49223327636719 + ], + 'descriptor': {'dimensions': [2, 2, 1], 'dataType': 'float32'} + } + }, + 'operators': [{ + 'name': 'where', + 'arguments': [ + {'condition': 'inputCondition'}, {'trueValue': 'inputTrueValue'}, + {'falseValue': 'inputFalseValue'} + ], + 'outputs': 'output' + }], + 'expectedOutputs': { + 'whereOutput': { + '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 + ], + 'descriptor': {'dimensions': [2, 2, 2, 3], 'dataType': 'float32'} + } + } + } + } +]; + +if (navigator.ml) { + whereTests.forEach((test) => { + webnn_conformance_test( + buildGraphAndCompute, getWherePrecisionTolerance, test); + }); +} else { + test(() => assert_implements(navigator.ml, 'missing navigator.ml')); +} diff --git a/webnn/idlharness.https.any.js b/webnn/idlharness.https.any.js index c2f579a2b4f58e..a5f0dcc2f91522 100644 --- a/webnn/idlharness.https.any.js +++ b/webnn/idlharness.https.any.js @@ -4,7 +4,7 @@ // META: script=./resources/utils.js // META: timeout=long -// https://webmachinelearning.github.io/webnn/ +// https://www.w3.org/TR/webnn/ 'use strict'; diff --git a/webnn/resources/test_data/abs.json b/webnn/resources/test_data/abs.json deleted file mode 100644 index d665da6bb4576c..00000000000000 --- a/webnn/resources/test_data/abs.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/add.json b/webnn/resources/test_data/add.json deleted file mode 100644 index 804ad5e345d0b7..00000000000000 --- a/webnn/resources/test_data/add.json +++ /dev/null @@ -1,928 +0,0 @@ -{ - "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" - } - }, - { - "name": "add float32 large inputs", - "inputs": { - "a": { - "shape": [6000, 6000], - "data": 89.32998288116718, - "type": "float32", - "constant": true - }, - "b": { - "shape": [6000, 6000], - "data": 77.24720464493949, - "type": "float32", - "constant": false - } - }, - "expected": { - "name": "output", - "shape": [6000, 6000], - "data": 166.57718752610668, - "type": "float32" - } - }, - { - "name": "add float32 with special character names", - "inputs": { - "12-L#!.☺": { - "shape": [1], - "data": [89.32998288116718], - "type": "float32", - "constant": true - }, - "🤦🏼‍♂️124DS#!F": { - "shape": [1], - "data": [77.2472046449394945], - "type": "float32", - "constant": false - } - }, - "expected": { - "name": "output", - "shape": [1], - "data": [166.57718752610668], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/arg_max.json b/webnn/resources/test_data/arg_max.json deleted file mode 100644 index a3995e4dd40f65..00000000000000 --- a/webnn/resources/test_data/arg_max.json +++ /dev/null @@ -1,464 +0,0 @@ -{ - "tests": [ - { - "name": "argMax float32 1D constant tensor, axis=0, 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 - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [], - "data": [ - 3 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 1D tensor, axis=0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [], - "data": [ - 3 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 2D tensor, axis=0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [6], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 3D tensor, axis=0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [3, 4], - "data": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 4D tensor, axis=0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [1, 4, 3], - "data": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 5D tensor, axis=0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [1, 4, 1, 3], - "data": [ - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 4D tensor axis=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" - } - }, - "axis": 2, - "expected": { - "name": "output", - "shape": [2, 1, 3], - "data": [ - 1, - 2, - 2, - 1, - 2, - 2 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 4D tensor, axis=3, 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" - } - }, - "axis": 3, - "options": { - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 4, 1], - "data": [ - 2, - 0, - 2, - 1, - 2, - 0, - 2, - 1 - ], - "type": "int32" - } - }, - { - "name": "argMax float32 4D tensor, axis=3, 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" - } - }, - "axis": 3, - "options": { - "keepDimensions": false - }, - "expected": { - "name": "output", - "shape": [2, 1, 4], - "data": [ - 2, - 0, - 2, - 1, - 2, - 0, - 2, - 1 - ], - "type": "int32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/arg_min.json b/webnn/resources/test_data/arg_min.json deleted file mode 100644 index a065873f5aa11e..00000000000000 --- a/webnn/resources/test_data/arg_min.json +++ /dev/null @@ -1,536 +0,0 @@ -{ - "tests": [ - { - "name": "argMin float32 1D constant tensor, axis 0, 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 - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [], - "data": [ - 7 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 1D tensor, axis 0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [], - "data": [ - 7 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 2D tensor, axis 0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [ - 6 - ], - "data": [ - 1, - 1, - 2, - 0, - 1, - 1 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 3D tensor, axis 0, 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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [ - 3, - 4 - ], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [ - 1, - 4, - 3 - ], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "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" - } - }, - "axis": 0, - "expected": { - "name": "output", - "shape": [ - 1, - 4, - 1, - 3 - ], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 4D tensor, axis=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" - } - }, - "axis": 2, - "expected": { - "name": "output", - "shape": [ - 2, - 1, - 3 - ], - "data": [ - 2, - 2, - 0, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 4D tensor, axis=0, 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" - } - }, - "axis": 0, - "options": { - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [ - 1, - 1, - 4, - 3 - ], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - }, - { - "name": "argMin float32 4D tensor, axis=0, 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" - } - }, - "axis": 0, - "options": { - "keepDimensions": false - }, - "expected": { - "name": "output", - "shape": [ - 1, - 4, - 3 - ], - "data": [ - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0 - ], - "type": "int32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/average_pool2d.json b/webnn/resources/test_data/average_pool2d.json deleted file mode 100644 index b95e9395e7f810..00000000000000 --- a/webnn/resources/test_data/average_pool2d.json +++ /dev/null @@ -1,1496 +0,0 @@ -{ - "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": "global averagePool2d float32 4D tensor all positive 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": [5, 5] - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 47.26926803588867, - 44.72445297241211 - ], - "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.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": "global averagePool2d float32 4D tensor options.layout=nhwc and options.windowDimensions", - "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", - "windowDimensions": [5, 5] - }, - "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], - "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/webnn/resources/test_data/batch_normalization.json b/webnn/resources/test_data/batch_normalization.json deleted file mode 100644 index f1d445e37244f9..00000000000000 --- a/webnn/resources/test_data/batch_normalization.json +++ /dev/null @@ -1,1092 +0,0 @@ -{ - "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 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 - }, - "expected": { - "shape": [2, 2, 2, 3], - "data": [ - -1039.0085734071204, - 200.12613597546277, - -120.36987167541395, - 212.10626540432202, - 1446.3732126569944, - -183.78396479879416, - -1300.9852072279227, - 1309.3257094058545, - -171.08979404258523, - -1104.0956031373803, - 835.2536189871761, - -183.83801576309426, - 425.3993215144054, - 997.6290832897452, - -91.55716013805052, - -1570.920072497096, - 1575.1810627320297, - -187.2757593197739, - 363.98524710447384, - 906.0018322105, - -102.5050592863526, - 603.1834043179756, - 221.6277675074517, - -139.02827100419768 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/cast.json b/webnn/resources/test_data/cast.json deleted file mode 100644 index 59d1036eeed5ad..00000000000000 --- a/webnn/resources/test_data/cast.json +++ /dev/null @@ -1,3040 +0,0 @@ -{ - "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/webnn/resources/test_data/ceil.json b/webnn/resources/test_data/ceil.json deleted file mode 100644 index b9bccbc3a07657..00000000000000 --- a/webnn/resources/test_data/ceil.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/clamp.json b/webnn/resources/test_data/clamp.json deleted file mode 100644 index f25019e4d9eb68..00000000000000 --- a/webnn/resources/test_data/clamp.json +++ /dev/null @@ -1,1169 +0,0 @@ -{ - "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, 2, 1, 2, 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/webnn/resources/test_data/concat.json b/webnn/resources/test_data/concat.json deleted file mode 100644 index 5e2285b75a0a0c..00000000000000 --- a/webnn/resources/test_data/concat.json +++ /dev/null @@ -1,3666 +0,0 @@ -{ - "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/webnn/resources/test_data/constant.json b/webnn/resources/test_data/constant.json deleted file mode 100644 index 06fe0a7a958e74..00000000000000 --- a/webnn/resources/test_data/constant.json +++ /dev/null @@ -1,754 +0,0 @@ -{ - "tests": [ - { - "name": "constant float32 0D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [], - "expected": { - "name": "output", - "shape": [], - "data": [ - 0.22992068529129028 - ], - "type": "float32" - } - }, - { - "name": "constant float32 1D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [24], - "expected": { - "name": "output", - "shape": [24], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 2D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [4, 6], - "expected": { - "name": "output", - "shape": [4, 6], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 3D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [2, 3, 4], - "expected": { - "name": "output", - "shape": [2, 3, 4], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of default float32 type step > 0", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7615746259689331, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22992068529129028, - 0.9914953112602234, - 1.7530698776245117, - 2.5146446228027344, - 3.276219129562378, - 4.0377936363220215, - 4.799368381500244, - 5.560943126678467, - 6.3225178718566895, - 7.084092140197754, - 7.845666885375977, - 8.6072416305542, - 9.368816375732422, - 10.130391120910645, - 10.891965866088867, - 11.653539657592773, - 12.415114402770996, - 13.176689147949219, - 13.938263893127441, - 14.699838638305664, - 15.461413383483887, - 16.22298812866211, - 16.984561920166016, - 17.746137619018555 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of default float32 type step = 0", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028, - 0.22992068529129028 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of default float32 type step < 0", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": -0.6248052716255188, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22992068529129028, - -0.3948845863342285, - -1.0196897983551025, - -1.6444951295852661, - -2.2693004608154297, - -2.8941056728363037, - -3.5189108848571777, - -4.143716335296631, - -4.768521308898926, - -5.393326759338379, - -6.018132209777832, - -6.642937183380127, - -7.26774263381958, - -7.892547607421875, - -8.517353057861328, - -9.142158508300781, - -9.766963958740234, - -10.391769409179688, - -11.016573905944824, - -11.641379356384277, - -12.26618480682373, - -12.890990257263184, - -13.515795707702637, - -14.140600204467773 - ], - "type": "float32" - } - }, - { - "name": "constant float32 5D tensor of default float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [2, 1, 4, 1, 3], - "expected": { - "name": "output", - "shape": [2, 1, 4, 1, 3], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of explict float32 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "float32", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22992068529129028, - 0.9836748242378235, - 1.737428903579712, - 2.491183042526245, - 3.2449371814727783, - 3.9986913204193115, - 4.752445697784424, - 5.506199836730957, - 6.25995397567749, - 7.013708114624023, - 7.767462253570557, - 8.52121639251709, - 9.274970054626465, - 10.028724670410156, - 10.782478332519531, - 11.536232948303223, - 12.289986610412598, - 13.043741226196289, - 13.797494888305664, - 14.551249504089355, - 15.30500316619873, - 16.058757781982422, - 16.812511444091797, - 17.566265106201172 - ], - "type": "float32" - } - }, - { - "name": "constant float32 4D tensor of float16 type", - "inputs": { - "start": { - "data": 0.22992068529129028, - "type": "float32" - }, - "step": { - "data": 0.7537541389465332, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "float16", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.22998046875, - 0.98388671875, - 1.7373046875, - 2.490234375, - 3.244140625, - 3.998046875, - 4.75390625, - 5.5078125, - 6.26171875, - 7.015625, - 7.765625, - 8.5234375, - 9.2734375, - 10.03125, - 10.78125, - 11.5390625, - 12.2890625, - 13.046875, - 13.796875, - 14.5546875, - 15.3046875, - 16.0625, - 16.8125, - 17.5625 - ], - "type": "float16" - } - }, - { - "name": "constant float32 4D tensor of int32 type", - "inputs": { - "start": { - "data": 7, - "type": "float32" - }, - "step": { - "data": 1, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "int32", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30 - ], - "type": "int32" - } - }, - { - "name": "constant float32 4D tensor of uint32 type", - "inputs": { - "start": { - "data": 7, - "type": "float32" - }, - "step": { - "data": 1, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "uint32", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30 - ], - "type": "uint32" - } - }, - { - "name": "constant float32 4D tensor of int64 type", - "inputs": { - "start": { - "data": 7, - "type": "float32" - }, - "step": { - "data": 1, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "int64", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - "7", - "8", - "9", - "10", - "11", - "12", - "13", - "14", - "15", - "16", - "17", - "18", - "19", - "20", - "21", - "22", - "23", - "24", - "25", - "26", - "27", - "28", - "29", - "30" - ], - "type": "int64" - } - }, - { - "name": "constant float32 4D tensor of int8 type step > 0", - "inputs": { - "start": { - "data": -9, - "type": "float32" - }, - "step": { - "data": 1, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "int8", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - -9, - -8, - -7, - -6, - -5, - -4, - -3, - -2, - -1, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14 - ], - "type": "int8" - } - }, - { - "name": "constant float32 4D tensor of int8 type step < 0", - "inputs": { - "start": { - "data": 7, - "type": "float32" - }, - "step": { - "data": -2, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "int8", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 7, - 5, - 3, - 1, - -1, - -3, - -5, - -7, - -9, - -11, - -13, - -15, - -17, - -19, - -21, - -23, - -25, - -27, - -29, - -31, - -33, - -35, - -37, - -39 - ], - "type": "int8" - } - }, - { - "name": "constant float32 4D tensor of uint8 type", - "inputs": { - "start": { - "data": 7, - "type": "float32" - }, - "step": { - "data": 1, - "type": "float32" - } - }, - "outputShape": [2, 2, 2, 3], - "type": "uint8", - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 28, - 29, - 30 - ], - "type": "uint8" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/conv2d.json b/webnn/resources/test_data/conv2d.json deleted file mode 100644 index e6e36021333db0..00000000000000 --- a/webnn/resources/test_data/conv2d.json +++ /dev/null @@ -1,1697 +0,0 @@ -{ - "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": "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 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], - "dilations": [1, 1], - "groups": 2, - "inputLayout": "nchw", - "filterLayout": "hwio", - "bias": { - "shape": [2], - "data": [ - 0.5423753606058896, - 0.8406119024104419 - ], - "type": "float32" - } - }, - "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/webnn/resources/test_data/conv_transpose2d.json b/webnn/resources/test_data/conv_transpose2d.json deleted file mode 100644 index ba25e04094cbe9..00000000000000 --- a/webnn/resources/test_data/conv_transpose2d.json +++ /dev/null @@ -1,2013 +0,0 @@ -{ - "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.2449943870306015, - 0.20362859964370728, - 0.002522633643820882, - 0.9113409519195557, - 0.8747221827507019, - 0.10648936033248901, - 0.6482304930686951, - 0.865131676197052, - 0.2742191553115845 - ], - "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.2449943870306015, - 0.0030817289371043444, - 0.20054687559604645, - 0.002522633643820882, - 0.23471179604530334, - 0.12160100787878036, - 0.19212977588176727, - 0.09953983873128891, - 0.6766291260719299, - 0.008511164225637913, - 0.5524802207946777, - 0.00694952392950654, - 0.6482304930686951, - 0.3358394503593445, - 0.5292922258377075, - 0.2742191553115845 - ], - "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 options.padding is the same upper padding", - "inputs": { - "input": { - "shape": [1, 3, 3, 1], - "data": [ - 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5, - 0.5, 0.5, 0.5 - ], - "type": "float32" - }, - "filter": { - "shape": [2, 3, 3, 1], - "data": [ - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "outputSizes": [6, 6], - "groups": 1, - "strides": [2, 2], - "dilations": [1, 1], - "padding": [0, 1, 0, 1], - "filterLayout": "ohwi", - "inputLayout": "nhwc" - }, - "expected": { - "shape": [1, 6, 6, 2], - "data": [ - 0.5, 0.5, 0.5, 0.5, 1.0, 1.0, 0.5, - 0.5, 1.0, 1.0, 0.5, 0.5, 0.5, 0.5, - 0.5, 0.5, 1.0, 1.0, 0.5, 0.5, 1.0, - 1.0, 0.5, 0.5, 1.0, 1.0, 1.0, 1.0, - 2.0, 2.0, 1.0, 1.0, 2.0, 2.0, 1.0, - 1.0, 0.5, 0.5, 0.5, 0.5, 1.0, 1.0, - 0.5, 0.5, 1.0, 1.0, 0.5, 0.5, 1.0, - 1.0, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, - 2.0, 2.0, 1.0, 1.0, 0.5, 0.5, 0.5, - 0.5, 1.0, 1.0, 0.5, 0.5, 1.0, 1.0, - 0.5, 0.5 - ], - "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.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" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/cos.json b/webnn/resources/test_data/cos.json deleted file mode 100644 index db7ade11e380a6..00000000000000 --- a/webnn/resources/test_data/cos.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/div.json b/webnn/resources/test_data/div.json deleted file mode 100644 index a60341181d1c87..00000000000000 --- a/webnn/resources/test_data/div.json +++ /dev/null @@ -1,882 +0,0 @@ -{ - "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/webnn/resources/test_data/elu.json b/webnn/resources/test_data/elu.json deleted file mode 100644 index b1c443282e4355..00000000000000 --- a/webnn/resources/test_data/elu.json +++ /dev/null @@ -1,539 +0,0 @@ -{ // 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/webnn/resources/test_data/equal.json b/webnn/resources/test_data/equal.json deleted file mode 100644 index bbd9143a0327dc..00000000000000 --- a/webnn/resources/test_data/equal.json +++ /dev/null @@ -1,982 +0,0 @@ -{ - "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/webnn/resources/test_data/erf.json b/webnn/resources/test_data/erf.json deleted file mode 100644 index 6f0b550cf7933a..00000000000000 --- a/webnn/resources/test_data/erf.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "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/webnn/resources/test_data/exp.json b/webnn/resources/test_data/exp.json deleted file mode 100644 index 2de52d951e95fc..00000000000000 --- a/webnn/resources/test_data/exp.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/expand.json b/webnn/resources/test_data/expand.json deleted file mode 100644 index 00bf4a37b4e9d5..00000000000000 --- a/webnn/resources/test_data/expand.json +++ /dev/null @@ -1,994 +0,0 @@ -{ - "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/webnn/resources/test_data/floor.json b/webnn/resources/test_data/floor.json deleted file mode 100644 index 3b5dba15762826..00000000000000 --- a/webnn/resources/test_data/floor.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/gather.json b/webnn/resources/test_data/gather.json deleted file mode 100644 index a67e708ae20b0e..00000000000000 --- a/webnn/resources/test_data/gather.json +++ /dev/null @@ -1,1495 +0,0 @@ -{ - "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 int32 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": "int32" - } - }, - "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" - } - }, - { - "name": "gather float32 2D tensor and int32 0D negative indices default options", - "inputs": { - "input": { - "shape": [2, 12], - "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": [-2], - "type": "int32" - } - }, - "expected": { - "name": "output", - "shape": [12], - "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 - ], - "type": "float32" - } - }, - { - "name": "gather float32 2D tensor and int32 0D out-of-bound positive indices default options", - "inputs": { - "input": { - "shape": [2, 12], - "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": [10], - "type": "int32" - } - }, - "expected": { - "name": "output", - "shape": [12], - "data": [ - 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" - } - }, - { - "name": "gather float32 2D tensor and int32 0D out-of-bound negative indices default options", - "inputs": { - "input": { - "shape": [2, 12], - "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": [-10], - "type": "int32" - } - }, - "expected": { - "name": "output", - "shape": [12], - "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 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/gelu.json b/webnn/resources/test_data/gelu.json deleted file mode 100644 index 3adf4b6a2b6a89..00000000000000 --- a/webnn/resources/test_data/gelu.json +++ /dev/null @@ -1,771 +0,0 @@ -{ - "tests": [ - { - "name": "gelu float32 0D scalar", - "inputs": { - "input": { - "shape": [], - "data": [ - -0.044885843992233276 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [], - "data": [ - -0.021639423444867134 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 0D scalar", - "inputs": { - "input": { - "shape": [], - "data": [ - -0.044891357421875 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [], - "data": [ - -0.021636962890625 - ], - "type": "float16" - } - }, - { - "name": "gelu float32 1D tensor", - "inputs": { - "input": { - "shape": [24], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [24], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float32 1D constant tensor", - "inputs": { - "input": { - "shape": [24], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "shape": [24], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 1D tensor", - "inputs": { - "input": { - "shape": [24], - "data": [ - 0.87841796875, - -0.0970458984375, - 0.13671875, - 0.464111328125, - -0.266357421875, - -0.8251953125, - 0.85302734375, - 0.384521484375, - 0.67724609375, - -0.481201171875, - 0.29833984375, - 0.677734375, - -0.5263671875, - 0.349853515625, - -0.129150390625, - 0.58544921875, - -0.89501953125, - 0.0283050537109375, - -0.0989990234375, - -0.8837890625, - -0.59619140625, - 0.318603515625, - 0.4794921875, - -0.06488037109375 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [24], - "data": [ - 0.71142578125, - -0.044769287109375, - 0.0758056640625, - 0.31494140625, - -0.105224609375, - -0.1688232421875, - 0.68505859375, - 0.2498779296875, - 0.50830078125, - -0.151611328125, - 0.1842041015625, - 0.5087890625, - -0.1575927734375, - 0.2227783203125, - -0.057952880859375, - 0.422119140625, - -0.1658935546875, - 0.01447296142578125, - -0.04559326171875, - -0.16650390625, - -0.164306640625, - 0.1990966796875, - 0.328125, - -0.03076171875 - ], - "type": "float16" - } - }, - { - "name": "gelu float32 2D tensor", - "inputs": { - "input": { - "shape": [4, 6], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [4, 6], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 2D tensor", - "inputs": { - "input": { - "shape": [4, 6], - "data": [ - 0.87841796875, - -0.0970458984375, - 0.13671875, - 0.464111328125, - -0.266357421875, - -0.8251953125, - 0.85302734375, - 0.384521484375, - 0.67724609375, - -0.481201171875, - 0.29833984375, - 0.677734375, - -0.5263671875, - 0.349853515625, - -0.129150390625, - 0.58544921875, - -0.89501953125, - 0.0283050537109375, - -0.0989990234375, - -0.8837890625, - -0.59619140625, - 0.318603515625, - 0.4794921875, - -0.06488037109375 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [4, 6], - "data": [ - 0.71142578125, - -0.044769287109375, - 0.0758056640625, - 0.31494140625, - -0.105224609375, - -0.1688232421875, - 0.68505859375, - 0.2498779296875, - 0.50830078125, - -0.151611328125, - 0.1842041015625, - 0.5087890625, - -0.1575927734375, - 0.2227783203125, - -0.057952880859375, - 0.422119140625, - -0.1658935546875, - 0.01447296142578125, - -0.04559326171875, - -0.16650390625, - -0.164306640625, - 0.1990966796875, - 0.328125, - -0.03076171875 - ], - "type": "float16" - } - }, - { - "name": "gelu float32 3D tensor", - "inputs": { - "input": { - "shape": [2, 3, 4], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 3, 4], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 3D tensor", - "inputs": { - "input": { - "shape": [2, 3, 4], - "data": [ - 0.87841796875, - -0.0970458984375, - 0.13671875, - 0.464111328125, - -0.266357421875, - -0.8251953125, - 0.85302734375, - 0.384521484375, - 0.67724609375, - -0.481201171875, - 0.29833984375, - 0.677734375, - -0.5263671875, - 0.349853515625, - -0.129150390625, - 0.58544921875, - -0.89501953125, - 0.0283050537109375, - -0.0989990234375, - -0.8837890625, - -0.59619140625, - 0.318603515625, - 0.4794921875, - -0.06488037109375 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [2, 3, 4], - "data": [ - 0.71142578125, - -0.044769287109375, - 0.0758056640625, - 0.31494140625, - -0.105224609375, - -0.1688232421875, - 0.68505859375, - 0.2498779296875, - 0.50830078125, - -0.151611328125, - 0.1842041015625, - 0.5087890625, - -0.1575927734375, - 0.2227783203125, - -0.057952880859375, - 0.422119140625, - -0.1658935546875, - 0.01447296142578125, - -0.04559326171875, - -0.16650390625, - -0.164306640625, - 0.1990966796875, - 0.328125, - -0.03076171875 - ], - "type": "float16" - } - }, - { - "name": "gelu float32 4D tensor", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 4D tensor", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 0.87841796875, - -0.0970458984375, - 0.13671875, - 0.464111328125, - -0.266357421875, - -0.8251953125, - 0.85302734375, - 0.384521484375, - 0.67724609375, - -0.481201171875, - 0.29833984375, - 0.677734375, - -0.5263671875, - 0.349853515625, - -0.129150390625, - 0.58544921875, - -0.89501953125, - 0.0283050537109375, - -0.0989990234375, - -0.8837890625, - -0.59619140625, - 0.318603515625, - 0.4794921875, - -0.06488037109375 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0.71142578125, - -0.044769287109375, - 0.0758056640625, - 0.31494140625, - -0.105224609375, - -0.1688232421875, - 0.68505859375, - 0.2498779296875, - 0.50830078125, - -0.151611328125, - 0.1842041015625, - 0.5087890625, - -0.1575927734375, - 0.2227783203125, - -0.057952880859375, - 0.422119140625, - -0.1658935546875, - 0.01447296142578125, - -0.04559326171875, - -0.16650390625, - -0.164306640625, - 0.1990966796875, - 0.328125, - -0.03076171875 - ], - "type": "float16" - } - }, - { - "name": "gelu float32 5D tensor", - "inputs": { - "input": { - "shape": [2, 1, 4, 1, 3], - "data": [ - 0.878292441368103, - -0.09706497937440872, - 0.1367187649011612, - 0.46406492590904236, - -0.26635801792144775, - -0.8252315521240234, - 0.8530909419059753, - 0.3846154808998108, - 0.6772316694259644, - -0.4811072051525116, - 0.2983909249305725, - 0.6777864098548889, - -0.526228129863739, - 0.3497541546821594, - -0.12918996810913086, - 0.5853934288024902, - -0.8950720429420471, - 0.028302494436502457, - -0.09901237487792969, - -0.8838679790496826, - -0.596120297908783, - 0.31863871216773987, - 0.4794037640094757, - -0.06489315629005432 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 1, 4, 1, 3], - "data": [ - 0.7115113139152527, - -0.0447796992957592, - 0.07579325884580612, - 0.3149605691432953, - -0.10520657151937485, - -0.16885890066623688, - 0.6851989030838013, - 0.24989959597587585, - 0.508513331413269, - -0.1516546905040741, - 0.18419598042964935, - 0.509049117565155, - -0.15753419697284698, - 0.22270187735557556, - -0.05795508995652199, - 0.42198580503463745, - -0.1659233123064041, - 0.014470770955085754, - -0.04560155048966408, - -0.1665063202381134, - -0.1642593890428543, - 0.19914908707141876, - 0.3279957175254822, - -0.030767757445573807 - ], - "type": "float32" - } - }, - { - "name": "gelu float16 5D tensor", - "inputs": { - "input": { - "shape": [2, 1, 4, 1, 3], - "data": [ - 0.87841796875, - -0.0970458984375, - 0.13671875, - 0.464111328125, - -0.266357421875, - -0.8251953125, - 0.85302734375, - 0.384521484375, - 0.67724609375, - -0.481201171875, - 0.29833984375, - 0.677734375, - -0.5263671875, - 0.349853515625, - -0.129150390625, - 0.58544921875, - -0.89501953125, - 0.0283050537109375, - -0.0989990234375, - -0.8837890625, - -0.59619140625, - 0.318603515625, - 0.4794921875, - -0.06488037109375 - ], - "type": "float16" - } - }, - "expected": { - "name": "output", - "shape": [2, 1, 4, 1, 3], - "data": [ - 0.71142578125, - -0.044769287109375, - 0.0758056640625, - 0.31494140625, - -0.105224609375, - -0.1688232421875, - 0.68505859375, - 0.2498779296875, - 0.50830078125, - -0.151611328125, - 0.1842041015625, - 0.5087890625, - -0.1575927734375, - 0.2227783203125, - -0.057952880859375, - 0.422119140625, - -0.1658935546875, - 0.01447296142578125, - -0.04559326171875, - -0.16650390625, - -0.164306640625, - 0.1990966796875, - 0.328125, - -0.03076171875 - ], - "type": "float16" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/gemm.json b/webnn/resources/test_data/gemm.json deleted file mode 100644 index 23a18b316caab6..00000000000000 --- a/webnn/resources/test_data/gemm.json +++ /dev/null @@ -1,1953 +0,0 @@ -{ - "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/webnn/resources/test_data/greater.json b/webnn/resources/test_data/greater.json deleted file mode 100644 index d7dc34d18bbce2..00000000000000 --- a/webnn/resources/test_data/greater.json +++ /dev/null @@ -1,982 +0,0 @@ -{ - "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/webnn/resources/test_data/greater_or_equal.json b/webnn/resources/test_data/greater_or_equal.json deleted file mode 100644 index e47ac4350abe80..00000000000000 --- a/webnn/resources/test_data/greater_or_equal.json +++ /dev/null @@ -1,970 +0,0 @@ -{ - "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/webnn/resources/test_data/hard_sigmoid.json b/webnn/resources/test_data/hard_sigmoid.json deleted file mode 100644 index 5d8c0c5daf1f10..00000000000000 --- a/webnn/resources/test_data/hard_sigmoid.json +++ /dev/null @@ -1,957 +0,0 @@ -{ // 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/webnn/resources/test_data/hard_swish.json b/webnn/resources/test_data/hard_swish.json deleted file mode 100644 index e43f62ede0eaff..00000000000000 --- a/webnn/resources/test_data/hard_swish.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/identity.json b/webnn/resources/test_data/identity.json deleted file mode 100644 index 6024e8786fb2e6..00000000000000 --- a/webnn/resources/test_data/identity.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "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/webnn/resources/test_data/instance_normalization.json b/webnn/resources/test_data/instance_normalization.json deleted file mode 100644 index a9fd493c9924ed..00000000000000 --- a/webnn/resources/test_data/instance_normalization.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "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/webnn/resources/test_data/l2_pool2d.json b/webnn/resources/test_data/l2_pool2d.json deleted file mode 100644 index a65687721a33c1..00000000000000 --- a/webnn/resources/test_data/l2_pool2d.json +++ /dev/null @@ -1,1174 +0,0 @@ -{ - "tests": [ - { - "name": "l2Pool2d float32 4D constant tensor all positive default options", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 289.01953125, - 292.6146545410156 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor default all positive options", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 289.01953125, - 292.6146545410156 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor default all negative options", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - -1.1957088708877563, - -9.706199645996094, - -39.54935836791992, - -82.34971618652344, - -32.87415313720703, - -50.22603225708008, - -31.17849349975586, - -55.817893981933594, - -46.70829391479492, - -38.68181228637695, - -63.299320220947266, - -35.09224319458008, - -80.93848419189453, - -82.8619613647461, - -40.41627502441406, - -34.86458206176758, - -84.33639526367188, - -84.11852264404297, - -5.525088787078857, - -99.03114318847656, - -75.505126953125, - -91.43389129638672, - -96.71258544921875, - -16.722585678100586, - -17.98292350769043, - -58.06570816040039, - -11.846800804138184, - -97.90313720703125, - -38.69822692871094, - -80.19510650634766, - -48.72047805786133, - -90.86722564697266, - -99.10758209228516, - -79.70288848876953, - -59.3824462890625, - -9.967330932617188, - -39.27534866333008, - -10.469644546508789, - -27.565326690673828, - -2.0468990802764893, - -81.88761901855469, - -66.88040161132812, - -85.98504638671875, - -29.674592971801758, - -19.649417877197266, - -89.39192199707031, - -61.13504409790039, - -84.16869354248047, - -77.36112213134766, - -91.17266082763672 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 298.928955078125, - 326.83587646484375 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.windowDimensions", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "windowDimensions": [3, 3] - }, - "expected": { - "name": "output", - "shape": [1, 2, 3, 3], - "data": [ - 194.45481872558594, - 189.54539489746094, - 189.85488891601562, - 160.0518341064453, - 167.1435546875, - 149.63897705078125, - 161.15570068359375, - 190.5449981689453, - 168.4636688232422, - 170.331787109375, - 155.60073852539062, - 174.72145080566406, - 165.07762145996094, - 165.45819091796875, - 161.11062622070312, - 176.6307373046875, - 174.245361328125, - 180.60714721679688 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.padding", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "padding": [1, 0, 0, 1] - }, - "expected": { - "name": "output", - "shape": [1, 2, 2, 2], - "data": [ - 254.81358337402344, - 233.14259338378906, - 289.01953125, - 269.777587890625, - 241.52200317382812, - 212.99337768554688, - 292.6146545410156, - 253.77178955078125 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.strides", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "windowDimensions": [3, 3], - "strides": [2, 2] - }, - "expected": { - "name": "output", - "shape": [1, 2, 2, 2], - "data": [ - 194.45481872558594, - 189.85488891601562, - 161.15570068359375, - 168.4636688232422, - 170.331787109375, - 174.72145080566406, - 176.6307373046875, - 180.60714721679688 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.dilations", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "windowDimensions": [3, 3], - "dilations": [2, 2] - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 189.47933959960938, - 207.25343322753906 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.layout=nchw", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "layout": "nchw" - }, - "expected": { - "name": "output", - "shape": [1, 2, 1, 1], - "data": [ - 289.01953125, - 292.6146545410156 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.layout=nhwc", - "inputs": { - "input": { - "shape": [1, 5, 5, 2], - "data": [ - 94.07447814941406, - 52.027313232421875, - 76.55464172363281, - 6.397815227508545, - 62.71847152709961, - 84.54785919189453, - 83.8726577758789, - 18.622516632080078, - 73.10235595703125, - 34.10626220703125, - 41.52470779418945, - 73.96932220458984, - 39.3339729309082, - 36.1437873840332, - 86.59486389160156, - 60.73781967163086, - 23.09039306640625, - 55.09187316894531, - 53.650146484375, - 63.8924446105957, - 0.00902052316814661, - 59.36124038696289, - 42.78899383544922, - 50.91202926635742, - 81.03960418701172, - 50.339813232421875, - 33.48585510253906, - 59.31963348388672, - 33.67196273803711, - 70.78031921386719, - 0.42822372913360596, - 35.56179428100586, - 80.07991790771484, - 82.53382873535156, - 5.929991722106934, - 7.572360038757324, - 48.89164733886719, - 61.90089416503906, - 15.282920837402344, - 14.084012985229492, - 13.335721969604492, - 90.86540985107422, - 39.06557846069336, - 39.56248474121094, - 97.06050109863281, - 67.77167510986328, - 83.68133544921875, - 69.69512176513672, - 21.79571533203125, - 89.54518127441406 - ], - "type": "float32" - } - }, - "options": { - "layout": "nhwc" - }, - "expected": { - "name": "output", - "shape": [1, 1, 1, 2], - "data": [ - 289.01953125, - 292.6146545410156 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.roundingType=floor", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "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": [ - 171.5061492919922, - 164.9919891357422, - 160.0518341064453, - 149.63897705078125, - 142.6990966796875, - 139.51637268066406, - 165.07762145996094, - 161.11062622070312 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.roundingType=ceil", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "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": [ - 171.5061492919922, - 164.9919891357422, - 8222.29296875, - 160.0518341064453, - 149.63897705078125, - 65.15908813476562, - 132.56260681152344, - 139.84808349609375, - 708.620849609375, - 142.6990966796875, - 139.51637268066406, - 5245.4814453125, - 165.07762145996094, - 161.11062622070312, - 96.38701629638672, - 150.1616668701172, - 146.8201904296875, - 8216.69921875 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.outputSizes ignores options.roundingType=floor", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "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": [ - 171.5061492919922, - 164.9919891357422, - 8222.29296875, - 160.0518341064453, - 149.63897705078125, - 65.15908813476562, - 132.56260681152344, - 139.84808349609375, - 708.620849609375, - 142.6990966796875, - 139.51637268066406, - 5245.4814453125, - 165.07762145996094, - 161.11062622070312, - 96.38701629638672, - 150.1616668701172, - 146.8201904296875, - 8216.69921875 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.outputSizes ignores options.roundingType=ceil", - "inputs": { - "input": { - "shape": [1, 2, 5, 5], - "data": [ - 94.07447814941406, - 76.55464172363281, - 62.71847152709961, - 83.8726577758789, - 73.10235595703125, - 41.52470779418945, - 39.3339729309082, - 86.59486389160156, - 23.09039306640625, - 53.650146484375, - 0.00902052316814661, - 42.78899383544922, - 81.03960418701172, - 33.48585510253906, - 33.67196273803711, - 0.42822372913360596, - 80.07991790771484, - 5.929991722106934, - 48.89164733886719, - 15.282920837402344, - 13.335721969604492, - 39.06557846069336, - 97.06050109863281, - 83.68133544921875, - 21.79571533203125, - 52.027313232421875, - 6.397815227508545, - 84.54785919189453, - 18.622516632080078, - 34.10626220703125, - 73.96932220458984, - 36.1437873840332, - 60.73781967163086, - 55.09187316894531, - 63.8924446105957, - 59.36124038696289, - 50.91202926635742, - 50.339813232421875, - 59.31963348388672, - 70.78031921386719, - 35.56179428100586, - 82.53382873535156, - 7.572360038757324, - 61.90089416503906, - 14.084012985229492, - 90.86540985107422, - 39.56248474121094, - 67.77167510986328, - 69.69512176513672, - 89.54518127441406 - ], - "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": [ - 171.5061492919922, - 164.9919891357422, - 160.0518341064453, - 149.63897705078125, - 142.6990966796875, - 139.51637268066406, - 165.07762145996094, - 161.11062622070312 - ], - "type": "float32" - } - }, - { - "name": "l2Pool2d float32 4D tensor options.dilations with options.strides", - "inputs": { - "input": { - "shape": [1, 7, 7, 2], - "data": [ - 6.5550384521484375, - 26.254413604736328, - 28.47271156311035, - 64.81202697753906, - 39.65838623046875, - 10.465584754943848, - 47.94060134887695, - 42.208946228027344, - 36.834041595458984, - 68.50249481201172, - 2.0496721267700195, - 49.73927688598633, - 59.97947311401367, - 71.08380889892578, - 0.20033331215381622, - 19.39293670654297, - 70.1269302368164, - 86.8837661743164, - 84.28858184814453, - 9.695697784423828, - 62.69126510620117, - 51.924110412597656, - 5.412675857543945, - 70.82118225097656, - 81.61302947998047, - 29.148712158203125, - 85.83409881591797, - 71.36548614501953, - 44.09445571899414, - 58.343570709228516, - 43.37118148803711, - 54.025882720947266, - 85.50556945800781, - 93.19215393066406, - 10.992993354797363, - 34.864158630371094, - 96.2605209350586, - 44.29584503173828, - 61.12482833862305, - 79.62699127197266, - 4.066447734832764, - 64.89644622802734, - 97.5897445678711, - 11.257055282592773, - 61.151283264160156, - 20.312341690063477, - 39.862640380859375, - 68.747314453125, - 89.61034393310547, - 22.28224754333496, - 41.36311721801758, - 62.9378662109375, - 79.54936218261719, - 55.64254379272461, - 54.47548294067383, - 77.04864501953125, - 56.83576965332031, - 80.57747650146484, - 70.43293762207031, - 85.67094421386719, - 19.527807235717773, - 33.87490463256836, - 14.498117446899414, - 92.85955810546875, - 96.8167724609375, - 28.399721145629883, - 99.917236328125, - 48.76692199707031, - 86.08634948730469, - 47.32324981689453, - 7.223662376403809, - 82.97200775146484, - 38.374778747558594, - 22.10988426208496, - 14.797550201416016, - 2.3872148990631104, - 83.26342010498047, - 46.41500473022461, - 28.659175872802734, - 13.919462203979492, - 55.413089752197266, - 62.68498992919922, - 78.54127502441406, - 31.142845153808594, - 4.806727886199951, - 33.233642578125, - 24.749773025512695, - 1.529007077217102, - 42.976322174072266, - 93.08572387695312, - 77.908935546875, - 45.74395751953125, - 62.868892669677734, - 60.689762115478516, - 20.046878814697266, - 13.203198432922363, - 33.33952713012695, - 0.5279953479766846 - ], - "type": "float32" - } - }, - "options": { - "windowDimensions": [3, 3], - "padding": [1, 0, 0, 1], - "strides": [2, 2], - "dilations": [1, 1], - "layout": "nhwc" - }, - "expected": { - "name": "output", - "shape": [1, 3, 3, 2], - "data": [ - 120.20333862304688, - 114.0977783203125, - 127.63969421386719, - 119.95613861083984, - 137.89837646484375, - 152.24261474609375, - 194.9647216796875, - 168.20205688476562, - 197.7173309326172, - 169.85887145996094, - 195.1484832763672, - 190.96127319335938, - 158.64576721191406, - 166.2051544189453, - 171.07916259765625, - 148.70985412597656, - 218.7123260498047, - 153.33311462402344 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/layer_normalization.json b/webnn/resources/test_data/layer_normalization.json deleted file mode 100644 index 6005776de5e223..00000000000000 --- a/webnn/resources/test_data/layer_normalization.json +++ /dev/null @@ -1,842 +0,0 @@ -{ - "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/webnn/resources/test_data/leaky_relu.json b/webnn/resources/test_data/leaky_relu.json deleted file mode 100644 index be810a90cea061..00000000000000 --- a/webnn/resources/test_data/leaky_relu.json +++ /dev/null @@ -1,609 +0,0 @@ -{ - "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/webnn/resources/test_data/lesser.json b/webnn/resources/test_data/lesser.json deleted file mode 100644 index 7527ea5c53a34f..00000000000000 --- a/webnn/resources/test_data/lesser.json +++ /dev/null @@ -1,970 +0,0 @@ -{ - "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/webnn/resources/test_data/lesser_or_equal.json b/webnn/resources/test_data/lesser_or_equal.json deleted file mode 100644 index f47bd3b9d9c31f..00000000000000 --- a/webnn/resources/test_data/lesser_or_equal.json +++ /dev/null @@ -1,970 +0,0 @@ -{ - "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/webnn/resources/test_data/linear.json b/webnn/resources/test_data/linear.json deleted file mode 100644 index 6cbb84e9cb0cee..00000000000000 --- a/webnn/resources/test_data/linear.json +++ /dev/null @@ -1,818 +0,0 @@ -{ // 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/webnn/resources/test_data/log.json b/webnn/resources/test_data/log.json deleted file mode 100644 index 0481061272dbfa..00000000000000 --- a/webnn/resources/test_data/log.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/logical_not.json b/webnn/resources/test_data/logical_not.json deleted file mode 100644 index 3a37652a134bc0..00000000000000 --- a/webnn/resources/test_data/logical_not.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "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/webnn/resources/test_data/matmul.json b/webnn/resources/test_data/matmul.json deleted file mode 100644 index cc1789ee25f5bb..00000000000000 --- a/webnn/resources/test_data/matmul.json +++ /dev/null @@ -1,1055 +0,0 @@ -{ - "tests": [ - { - "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 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/webnn/resources/test_data/max.json b/webnn/resources/test_data/max.json deleted file mode 100644 index 26285042d0443a..00000000000000 --- a/webnn/resources/test_data/max.json +++ /dev/null @@ -1,882 +0,0 @@ -{ - "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/webnn/resources/test_data/max_pool2d.json b/webnn/resources/test_data/max_pool2d.json deleted file mode 100644 index 216b4c55ddbe30..00000000000000 --- a/webnn/resources/test_data/max_pool2d.json +++ /dev/null @@ -1,1104 +0,0 @@ -{ - "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.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], - "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/webnn/resources/test_data/min.json b/webnn/resources/test_data/min.json deleted file mode 100644 index a08e6514286886..00000000000000 --- a/webnn/resources/test_data/min.json +++ /dev/null @@ -1,882 +0,0 @@ -{ - "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/webnn/resources/test_data/mul.json b/webnn/resources/test_data/mul.json deleted file mode 100644 index 3de9018427372e..00000000000000 --- a/webnn/resources/test_data/mul.json +++ /dev/null @@ -1,882 +0,0 @@ -{ - "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/webnn/resources/test_data/neg.json b/webnn/resources/test_data/neg.json deleted file mode 100644 index 34dee53df164b1..00000000000000 --- a/webnn/resources/test_data/neg.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/pad.json b/webnn/resources/test_data/pad.json deleted file mode 100644 index 53e8ed8f5979e2..00000000000000 --- a/webnn/resources/test_data/pad.json +++ /dev/null @@ -1,797 +0,0 @@ -{ - "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/webnn/resources/test_data/pow.json b/webnn/resources/test_data/pow.json deleted file mode 100644 index 1738722b10bad4..00000000000000 --- a/webnn/resources/test_data/pow.json +++ /dev/null @@ -1,880 +0,0 @@ -{ - "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/webnn/resources/test_data/prelu.json b/webnn/resources/test_data/prelu.json deleted file mode 100644 index 14a7c412dd77e1..00000000000000 --- a/webnn/resources/test_data/prelu.json +++ /dev/null @@ -1,994 +0,0 @@ -{ - "tests": [ - { - "name": "prelu float32 0D scalar", - "inputs": { - "x": { - "shape": [], - "data": [ - -4.794857500523286 - ], - "type": "float32" - }, - "slope": { - "shape": [], - "data": [ - 1.1202747481570352 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "shape": [], - "data": [ - -5.371557712554932 - ], - "type": "float32" - } - }, - { - "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/webnn/resources/test_data/reciprocal.json b/webnn/resources/test_data/reciprocal.json deleted file mode 100644 index c71ac28005029c..00000000000000 --- a/webnn/resources/test_data/reciprocal.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "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/webnn/resources/test_data/reduce_l1.json b/webnn/resources/test_data/reduce_l1.json deleted file mode 100644 index 7637c02be23ce2..00000000000000 --- a/webnn/resources/test_data/reduce_l1.json +++ /dev/null @@ -1,784 +0,0 @@ -{ - "tests": [ - { - "name": "reduceL1 float32 0D constant tensor default options", // default options: {axes: null, keepDimensions: false} - "inputs": { - "input": { - "shape": [], - "data": [ - 5.50882625579834 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 5.50882625579834, - "type": "float32" - } - }, - { - "name": "reduceL1 float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 5.50882625579834 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 5.50882625579834, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 108.43173217773438, - 315.6007995605469, - 359.5506591796875, - 309.13702392578125 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_l2.json b/webnn/resources/test_data/reduce_l2.json deleted file mode 100644 index b4d270a701927e..00000000000000 --- a/webnn/resources/test_data/reduce_l2.json +++ /dev/null @@ -1,784 +0,0 @@ -{ - "tests": [ - { - "name": "reduceL2 float32 0D constant tensor default options", // default options: {axes: null, keepDimensions: false} - "inputs": { - "input": { - "shape": [], - "data": [ - 4.860228061676025 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 4.860228061676025, - "type": "float32" - } - }, - { - "name": "reduceL2 float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 4.860228061676025 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 4.860228061676025, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 138.580078125, - 166.67791748046875, - 149.91552734375, - 67.6578598022461 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_log_sum.json b/webnn/resources/test_data/reduce_log_sum.json deleted file mode 100644 index f3de240e458ea3..00000000000000 --- a/webnn/resources/test_data/reduce_log_sum.json +++ /dev/null @@ -1,704 +0,0 @@ -{ - "tests": [ - { - "name": "reduceLogSum float32 0D constant tensor default options", // default options: {axes: null, keepDimensions: false} - "inputs": { - "input": { - "shape": [], - "data": [ - 64.54827117919922 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 4.167413234710693, - "type": "float32" - } - }, - { - "name": "reduceLogSum float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 64.54827117919922 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 4.167413234710693, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 5.7273993492126465, - 5.64375114440918, - 5.453810214996338, - 5.758983135223389 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_log_sum_exp.json b/webnn/resources/test_data/reduce_log_sum_exp.json deleted file mode 100644 index b999a567aa5bb2..00000000000000 --- a/webnn/resources/test_data/reduce_log_sum_exp.json +++ /dev/null @@ -1,784 +0,0 @@ -{ - "tests": [ - { - "name": "reduceLogSumExp float32 0D constant tensor default options", // default options: {axes: null, keepDimensions: false} - "inputs": { - "input": { - "shape": [], - "data": [ - 0.7974132895469666 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 0.7974132895469666, - "type": "float32" - } - }, - { - "name": "reduceLogSumExp float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 0.7974132895469666 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 0.7974132895469666, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 8.563796997070312, - 5.500619411468506, - 9.753945350646973, - 9.20864486694336 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_max.json b/webnn/resources/test_data/reduce_max.json deleted file mode 100644 index 6cd55492692dc9..00000000000000 --- a/webnn/resources/test_data/reduce_max.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "tests": [ - { - "name": "reduceMax float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - 32.16658401489258 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 32.16658401489258, - "type": "float32" - } - }, - { - "name": "reduceMax float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 32.16658401489258 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 32.16658401489258, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 90.42288208007812, - 94.99645233154297, - 96.55397033691406, - 99.77313232421875 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_mean.json b/webnn/resources/test_data/reduce_mean.json deleted file mode 100644 index b990b0f93bba1b..00000000000000 --- a/webnn/resources/test_data/reduce_mean.json +++ /dev/null @@ -1,776 +0,0 @@ -{ - "tests": [ - { - "name": "reduceMean float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - 95.84498596191406 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 95.84498596191406, - "type": "float32" - } - }, - { - "name": "reduceMean float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 95.84498596191406 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 95.84498596191406, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "shape": [2, 1, 2, 1], - "data": [ - 52.287559509277344, - 45.10261917114258, - 47.640018463134766, - 16.211700439453125 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_min.json b/webnn/resources/test_data/reduce_min.json deleted file mode 100644 index 4d91480bb95a04..00000000000000 --- a/webnn/resources/test_data/reduce_min.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "tests": [ - { - "name": "reduceMin float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - -58.76195526123047 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": -58.76195526123047, - "type": "float32" - } - }, - { - "name": "reduceMin float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - -58.76195526123047 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": -58.76195526123047, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - -87.9623031616211, - -53.747413635253906, - -84.4076919555664, - -55.97655487060547 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_product.json b/webnn/resources/test_data/reduce_product.json deleted file mode 100644 index e9b2dc34c26894..00000000000000 --- a/webnn/resources/test_data/reduce_product.json +++ /dev/null @@ -1,664 +0,0 @@ -{ - "tests": [ - { - "name": "reduceProduct float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - -68.75911712646484 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": -68.75911712646484, - "type": "float32" - } - }, - { - "name": "reduceProduct float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - -68.75911712646484 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": -68.75911712646484, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - -3638925568, - 6523364352, - -414643360, - 1610916352 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_sum.json b/webnn/resources/test_data/reduce_sum.json deleted file mode 100644 index fd93e131b3e290..00000000000000 --- a/webnn/resources/test_data/reduce_sum.json +++ /dev/null @@ -1,776 +0,0 @@ -{ - "tests": [ - { - "name": "reduceSum float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - 69.6038589477539 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 69.6038589477539, - "type": "float32" - } - }, - { - "name": "reduceSum float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 69.6038589477539 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 69.6038589477539, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "shape": [2, 1, 2, 1], - "data": [ - 355.21942138671875, - 185.98255920410156, - 362.3598937988281, - 410.3175354003906 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reduce_sum_square.json b/webnn/resources/test_data/reduce_sum_square.json deleted file mode 100644 index d308cad463a291..00000000000000 --- a/webnn/resources/test_data/reduce_sum_square.json +++ /dev/null @@ -1,784 +0,0 @@ -{ - "tests": [ - { - "name": "reduceSumSquare float32 0D constant tensor default options", - "inputs": { - "input": { - "shape": [], - "data": [ - 52.5615348815918 - ], - "type": "float32", - "constant": true - } - }, - "expected": { - "name": "output", - "data": 2762.71484375, - "type": "float32" - } - }, - { - "name": "reduceSumSquare float32 0D constant tensor empty axes", - "inputs": { - "input": { - "shape": [], - "data": [ - 52.5615348815918 - ], - "type": "float32", - "constant": true - } - }, - "options": { - "axes": [] - }, - "expected": { - "name": "output", - "data": 2762.71484375, - "type": "float32" - } - }, - { - "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], - "keepDimensions": false - }, - "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], - "keepDimensions": true - }, - "expected": { - "name": "output", - "shape": [2, 1, 2, 1], - "data": [ - 12302.474609375, - 22772.77734375, - 26919.09765625, - 11281.5068359375 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/relu.json b/webnn/resources/test_data/relu.json deleted file mode 100644 index 248902c6658a51..00000000000000 --- a/webnn/resources/test_data/relu.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/resample2d.json b/webnn/resources/test_data/resample2d.json deleted file mode 100644 index 605d1b55c017a5..00000000000000 --- a/webnn/resources/test_data/resample2d.json +++ /dev/null @@ -1,527 +0,0 @@ -{ - "tests": [ - { - "name": "resample2d float32 4D tensor default options", - "inputs": { - "input": { - "shape": [1, 1, 4, 6], // nchw - "data": [ - 3.8600528355143604, - 45.18463077286585, - 87.67153742917091, - 98.78210347338205, - 66.3741434682883, - 3.4115834948988955, - 86.14930500548006, - 95.98133720121507, - 76.87126314100948, - 16.52591355131756, - 65.98782867250333, - 25.470921564461158, - 22.56010547750855, - 92.08479613461083, - 85.80876634651386, - 92.6316602716033, - 29.91620870840146, - 75.40461275485572, - 62.063754512670435, - 1.7712158798243394, - 99.47231285272224, - 11.440550135595085, - 25.39634271166711, - 67.02175102425608 - ], - "type": "float32" - } - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 3.8600528240203857, - 45.18463134765625, - 87.67153930664062, - 98.7821044921875, - 66.3741455078125, - 3.411583423614502, - 86.14930725097656, - 95.98133850097656, - 76.87126159667969, - 16.52591323852539, - 65.98783111572266, - 25.470922470092773, - 22.56010627746582, - 92.08479309082031, - 85.80876922607422, - 92.63166046142578, - 29.916208267211914, - 75.40460968017578, - 62.06375503540039, - 1.7712159156799316, - 99.4723129272461, - 11.440549850463867, - 25.396343231201172, - 67.0217514038086 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.scales", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "scales": [2.0, 2.0] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.sizes", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "sizes": [4, 6] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.sizes ignored options.scales", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "scales": [0.5, 0.5], - "sizes": [4, 6] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.axes=[1, 2]", - "inputs": { - "input": { - "shape": [1, 2, 3, 1], // nhwc - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "sizes": [4, 6], - "axes": [1, 2] - }, - "expected": { - "shape": [1, 4, 6, 1], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor explicit options.axes=[2, 3]", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], // nchw - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "sizes": [4, 6], - "axes": [2, 3] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor explicit options.mode='nearest-neighbor'", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "mode": "nearest-neighbor", - "sizes": [4, 6] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 59.92947006225586, - 59.92947006225586, - 41.98918914794922, - 41.98918914794922, - 66.39534759521484, - 66.39534759521484, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281, - 90.7006607055664, - 90.7006607055664, - 86.95105743408203, - 86.95105743408203, - 79.10005187988281, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.scales options.mode='linear'", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "mode": "linear", - "scales": [2.0, 2.0] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 55.444400787353516, - 46.47425842285156, - 48.090728759765625, - 60.29380798339844, - 66.39534759521484, - 67.62226867675781, - 64.02411651611328, - 56.82780838012695, - 57.31512451171875, - 65.48605346679688, - 69.57152557373047, - 83.00786590576172, - 81.18354797363281, - 77.534912109375, - 75.76390838623047, - 75.87055206298828, - 75.92387390136719, - 90.7006607055664, - 89.76325988769531, - 87.88845825195312, - 84.9883041381836, - 81.06280517578125, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.sizes options.mode='linear'", - "inputs": { - "input": { - "shape": [1, 1, 2, 3], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "mode": "linear", - "sizes": [4, 6] - }, - "expected": { - "shape": [1, 1, 4, 6], - "data": [ - 59.92947006225586, - 55.444400787353516, - 46.47425842285156, - 48.090728759765625, - 60.29380798339844, - 66.39534759521484, - 67.62226867675781, - 64.02411651611328, - 56.82780838012695, - 57.31512451171875, - 65.48605346679688, - 69.57152557373047, - 83.00786590576172, - 81.18354797363281, - 77.534912109375, - 75.76390838623047, - 75.87055206298828, - 75.92387390136719, - 90.7006607055664, - 89.76325988769531, - 87.88845825195312, - 84.9883041381836, - 81.06280517578125, - 79.10005187988281 - ], - "type": "float32" - } - }, - { - "name": "resample2d(upsample) float32 4D tensor options.axes=[1, 2] options.mode='linear'", - "inputs": { - "input": { - "shape": [1, 2, 3, 1], - "data": [ - 59.92947164849423, - 41.989187594696546, - 66.39534663077877, - 90.70066412516924, - 86.95106056135486, - 79.10004839481242 - ], - "type": "float32" - } - }, - "options": { - "mode": "linear", - "sizes": [4, 6], - "axes": [1, 2] - }, - "expected": { - "shape": [1, 4, 6, 1], - "data": [ - 59.92947006225586, - 55.444400787353516, - 46.47425842285156, - 48.090728759765625, - 60.29380798339844, - 66.39534759521484, - 67.62226867675781, - 64.02411651611328, - 56.82780838012695, - 57.31512451171875, - 65.48605346679688, - 69.57152557373047, - 83.00786590576172, - 81.18354797363281, - 77.534912109375, - 75.76390838623047, - 75.87055206298828, - 75.92387390136719, - 90.7006607055664, - 89.76325988769531, - 87.88845825195312, - 84.9883041381836, - 81.06280517578125, - 79.10005187988281 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/reshape.json b/webnn/resources/test_data/reshape.json deleted file mode 100644 index ada3daa4e2de4b..00000000000000 --- a/webnn/resources/test_data/reshape.json +++ /dev/null @@ -1,2056 +0,0 @@ -{ - "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/webnn/resources/test_data/sigmoid.json b/webnn/resources/test_data/sigmoid.json deleted file mode 100644 index 69756fbb9c2e30..00000000000000 --- a/webnn/resources/test_data/sigmoid.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/sin.json b/webnn/resources/test_data/sin.json deleted file mode 100644 index 1fe76df45fbf56..00000000000000 --- a/webnn/resources/test_data/sin.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/slice.json b/webnn/resources/test_data/slice.json deleted file mode 100644 index 28cfd2c0e266ca..00000000000000 --- a/webnn/resources/test_data/slice.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "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/webnn/resources/test_data/softmax.json b/webnn/resources/test_data/softmax.json deleted file mode 100644 index cbe868ac1dee4c..00000000000000 --- a/webnn/resources/test_data/softmax.json +++ /dev/null @@ -1,290 +0,0 @@ -{ - "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" - } - }, - { - "name": "softmax float32 3D constant tensor", - "inputs": { - "x": { - "shape": [1, 3, 4], - "data": [ - 0.4301910996437073, - 0.5471914410591125, - -1.1637765169143677, - 0.18390046060085297, - 0.583903968334198, - 0.17356790602207184, - 0.5397239923477173, - -0.9535139799118042, - -0.5920282602310181, - -0.17344485223293304, - 0.14395014941692352, - -0.37920907139778137 - ], - "type": "float32", - "constant": true - } - }, - "axis": 1, - "expected": { - "name": "output", - "shape": [1, 3, 4], - "data": [ - 0.39589041471481323, - 0.45983806252479553, - 0.09812675416469574, - 0.529077410697937, - 0.4616699814796448, - 0.31647709012031555, - 0.5390242338180542, - 0.16964708268642426, - 0.142439603805542, - 0.22368484735488892, - 0.36284899711608887, - 0.3012755215167999 - ], - "type": "float32" - } - }, - { - "name": "softmax float32 4D tensor", - "inputs": { - "x": { - "shape": [3, 4, 1, 1], - "data": [ - 0.4301910996437073, - 0.5471914410591125, - -1.1637765169143677, - 0.18390046060085297, - 0.583903968334198, - 0.17356790602207184, - 0.5397239923477173, - -0.9535139799118042, - -0.5920282602310181, - -0.17344485223293304, - 0.14395014941692352, - -0.37920907139778137 - ], - "type": "float32" - } - }, - "axis": 1, - "expected": { - "name": "output", - "shape": [3, 4, 1, 1], - "data": [ - 0.3216537833213806, - 0.3615773916244507, - 0.06533370912075043, - 0.25143513083457947, - 0.35271573066711426, - 0.23400123417377472, - 0.33747196197509766, - 0.07581108063459396, - 0.17110128700733185, - 0.26004093885421753, - 0.3571779429912567, - 0.2116798311471939 - ], - "type": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/softplus.json b/webnn/resources/test_data/softplus.json deleted file mode 100644 index 373612d5ca23d6..00000000000000 --- a/webnn/resources/test_data/softplus.json +++ /dev/null @@ -1,401 +0,0 @@ -{ // softplus: The calculation follows the expression ln(1 + exp(x)). - "tests": [ - { - "name": "softplus float32 1D constant tensor", - "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", - "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", - "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", - "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", - "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", - "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" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/softsign.json b/webnn/resources/test_data/softsign.json deleted file mode 100644 index 290f6711d09324..00000000000000 --- a/webnn/resources/test_data/softsign.json +++ /dev/null @@ -1,467 +0,0 @@ -{ // 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/webnn/resources/test_data/split.json b/webnn/resources/test_data/split.json deleted file mode 100644 index 6432044ea20424..00000000000000 --- a/webnn/resources/test_data/split.json +++ /dev/null @@ -1,744 +0,0 @@ -{ - "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/webnn/resources/test_data/sqrt.json b/webnn/resources/test_data/sqrt.json deleted file mode 100644 index fa59308d45ba6c..00000000000000 --- a/webnn/resources/test_data/sqrt.json +++ /dev/null @@ -1,421 +0,0 @@ -{ - "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/webnn/resources/test_data/sub.json b/webnn/resources/test_data/sub.json deleted file mode 100644 index 207d9106b42056..00000000000000 --- a/webnn/resources/test_data/sub.json +++ /dev/null @@ -1,882 +0,0 @@ -{ - "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/webnn/resources/test_data/tan.json b/webnn/resources/test_data/tan.json deleted file mode 100644 index 63c7056d905466..00000000000000 --- a/webnn/resources/test_data/tan.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/tanh.json b/webnn/resources/test_data/tanh.json deleted file mode 100644 index 063c10623d83b8..00000000000000 --- a/webnn/resources/test_data/tanh.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "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/webnn/resources/test_data/transpose.json b/webnn/resources/test_data/transpose.json deleted file mode 100644 index f7e6a7d2dd2f74..00000000000000 --- a/webnn/resources/test_data/transpose.json +++ /dev/null @@ -1,746 +0,0 @@ -{ - "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/webnn/resources/test_data/triangular.json b/webnn/resources/test_data/triangular.json deleted file mode 100644 index 652f780d58b6f1..00000000000000 --- a/webnn/resources/test_data/triangular.json +++ /dev/null @@ -1,1101 +0,0 @@ -{ - "tests": [ - { - "name": "triangular float32 2D tensor default options", - "inputs": { - "input": { - "shape": [4, 6], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [4, 6], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 0, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 0, - 0, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 0, - 0, - 0, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 3D tensor default options", - "inputs": { - "input": { - "shape": [2, 3, 4], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 3, 4], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - 0, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - 0, - 0, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 0, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - 0, - 0, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor default options", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - 0, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 0, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 0, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - 0, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 5D tensor default options", - "inputs": { - "input": { - "shape": [2, 1, 4, 1, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "expected": { - "name": "output", - "shape": [2, 1, 4, 1, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor explict options.upper=true", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": true - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - 0, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 0, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 0, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - 0, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.upper=false", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": false - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - 0, - 0, - -98.47772216796875, - -94.51172637939453, - 0, - 24.678754806518555, - 0, - 0, - 97.25071716308594, - 73.36241149902344, - 0, - 41.64348602294922, - 0, - 0, - 67.48285675048828, - 42.132598876953125, - 0, - 20.88446617126465, - 0, - 0, - -88.97057342529297, - 77.58269500732422, - 0 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor explict options.diagonal=0", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "diagonal": 0 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - 0, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 0, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 0, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - 0, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.diagonal=1", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "diagonal": 1 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0, - -86.21631622314453, - 50.38116455078125, - 0, - 0, - -21.42218589782715, - 0, - -50.355342864990234, - -37.015724182128906, - 0, - 0, - -75.12358856201172, - 0, - 58.862911224365234, - -29.916187286376953, - 0, - 0, - -70.27587127685547, - 0, - 71.37139892578125, - -84.96932220458984, - 0, - 0, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.diagonal=-1", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "diagonal": -1 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor fully zero options.diagonal=3", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "diagonal": 3 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 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": "float32" - } - }, - { - "name": "triangular float32 4D tensor fully copied options.diagonal=-2", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "diagonal": -2 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.upper=true options.diagonal=1", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": true, - "diagonal": 1 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0, - -86.21631622314453, - 50.38116455078125, - 0, - 0, - -21.42218589782715, - 0, - -50.355342864990234, - -37.015724182128906, - 0, - 0, - -75.12358856201172, - 0, - 58.862911224365234, - -29.916187286376953, - 0, - 0, - -70.27587127685547, - 0, - 71.37139892578125, - -84.96932220458984, - 0, - 0, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.upper=false options.diagonal=1", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": false, - "diagonal": 1 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 0, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - 0, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - 0, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - 0, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor options.upper=false options.diagonal=-1", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": false, - "diagonal": -1 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 0, - 0, - 0, - -98.47772216796875, - 0, - 0, - 0, - 0, - 0, - 97.25071716308594, - 0, - 0, - 0, - 0, - 0, - 67.48285675048828, - 0, - 0, - 0, - 0, - 0, - -88.97057342529297, - 0, - 0 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor fully copied options.upper=false options.diagonal=3", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": false, - "diagonal": 3 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - { - "name": "triangular float32 4D tensor fully zero options.upper=false options.diagonal=-2", - "inputs": { - "input": { - "shape": [2, 2, 2, 3], - "data": [ - 84.9194564819336, - -86.21631622314453, - 50.38116455078125, - -98.47772216796875, - -94.51172637939453, - -21.42218589782715, - 24.678754806518555, - -50.355342864990234, - -37.015724182128906, - 97.25071716308594, - 73.36241149902344, - -75.12358856201172, - 41.64348602294922, - 58.862911224365234, - -29.916187286376953, - 67.48285675048828, - 42.132598876953125, - -70.27587127685547, - 20.88446617126465, - 71.37139892578125, - -84.96932220458984, - -88.97057342529297, - 77.58269500732422, - 91.03327178955078 - ], - "type": "float32" - } - }, - "options": { - "upper": false, - "diagonal": -2 - }, - "expected": { - "name": "output", - "shape": [2, 2, 2, 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": "float32" - } - } - ] -} \ No newline at end of file diff --git a/webnn/resources/test_data/where.json b/webnn/resources/test_data/where.json deleted file mode 100644 index 7c55b3171aed78..00000000000000 --- a/webnn/resources/test_data/where.json +++ /dev/null @@ -1,1817 +0,0 @@ -{ - "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/webnn/resources/utils.js b/webnn/resources/utils.js index cdeb2410984ceb..e4d042a70fec73 100644 --- a/webnn/resources/utils.js +++ b/webnn/resources/utils.js @@ -1,38 +1,44 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#enumdef-mloperanddatatype +// https://www.w3.org/TR/webnn/#enumdef-mloperanddatatype const TypedArrayDict = { - // workaround use Uint16 for Float16 + float32: Float32Array, + + // Proposal to add float16 TypedArrays to JavaScript. + // URL: https://tc39.es/proposal-float16array/ + // Use workaround Uint16 for Float16 float16: Uint16Array, - float32: Float32Array, + int64: BigInt64Array, + uint64: BigUint64Array, int32: Int32Array, uint32: Uint32Array, int8: Int8Array, uint8: Uint8Array, - int64: BigInt64Array, }; + const kIntTypes = ['uint8', 'int8', 'uint32', 'int32', 'uint64', 'int64']; const kFloatTypes = ['float16', 'float32']; -const findCompatibleType = - (dataType, supportedTypes) => { - for (let supportedType of supportedTypes) { - if (kIntTypes.includes(dataType)) { - if (kIntTypes.indexOf(supportedType) > kIntTypes.indexOf(dataType)) { - return supportedType; - } - } +const findCompatibleType = (dataType, supportedTypes) => { + for (let supportedType of supportedTypes) { + if (kIntTypes.includes(dataType)) { + if (kIntTypes.indexOf(supportedType) > kIntTypes.indexOf(dataType)) { + return supportedType; + } + } - if (kFloatTypes.includes(dataType)) { - if (kFloatTypes.indexOf(supportedType) > - kFloatTypes.indexOf(dataType)) { - return supportedType; - } - } + if (kFloatTypes.includes(dataType)) { + if (kFloatTypes.indexOf(supportedType) > kFloatTypes.indexOf(dataType)) { + return supportedType; } - return null; } + } + return null; +}; + +// The maximum index to validate for the output's expected value. +const kMaximumIndexToValidate = 1000; const kContextOptionsForVariant = { cpu: { @@ -46,8 +52,67 @@ const kContextOptionsForVariant = { }, }; -// The maximum index to validate for the output's expected value. -const kMaximumIndexToValidate = 1000; +const variant = location.search.substring(1); +const contextOptions = kContextOptionsForVariant[variant]; + +const assertDescriptorsEquals = (outputOperand, expected) => { + const dataType = + expected.castedType ? expected.castedType : expected.dataType; + assert_true( + outputOperand.dataType() === dataType, + 'actual output dataType should be equal to expected output dataType'); + assert_array_equals( + outputOperand.shape(), expected.dimensions, + 'actual output dimesnisons should be equal to expected output dimensions'); +}; + +// 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; +}; const getTypedArrayData = (type, size, data) => { let outData; @@ -78,419 +143,16 @@ const getTypedArrayData = (type, size, data) => { return outData; }; -const bytesPerDataType = (dataType) => { - if (dataType === 'int8' || dataType === 'uint8') { - return 1; - } else if (dataType === 'float16') { - return 2; - } else if ( - dataType === 'float32' || dataType === 'int32' || dataType === 'uint32') { - return 4; - } else if (dataType === 'int64' || dataType === 'uint64') { - return 8; - } -}; - const sizeOfShape = (array) => { return array.reduce((accumulator, currentValue) => accumulator * currentValue, 1); }; -const sizeOfDescriptor = (descriptor) => { - return descriptor.dimensions.reduce( - (accumulator, currentValue) => accumulator * currentValue, - bytesPerDataType(descriptor.dataType)); -}; - -const getDescriptorFromBuffer = (buffer) => { - return {dataType: buffer.dataType, dimensions: buffer.shape}; -}; - -/** - * 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 expected resource from given resources with output name. - * @param {Array} resources - An array of given resources - * @param {String} outputName - An output name - * @returns {Object} An object of expected resource - */ -const getNamedResource = (resources, outputName) => { - let ret; - for (let resource of resources) { - if (resource.name === outputName) { - ret = resource; - break; - } - } - if (ret === undefined) { - throw new Error(`Failed to get expected resource 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 or l2Pool2d 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.length ? - sizes.reduce((accumulator, currentValue) => accumulator * currentValue) : - 1; - 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; -}; - -/** - * Get ULP tolerance of resample2d operations. - * @param {Object} resources - Resources used for building a graph - * @param {String} operationName - An operation name - * @returns {Number} A tolerance number - */ -const getResample2dPrecisionTolerance = (resources, operationName) => { - const options = {...resources.options}; - let tolerance; - if (options.mode && options.mode === 'linear') { - // interpolation mode is linear - const precisionType = resources.expected.type; - if (precisionType === 'float32') { - tolerance = 84; - } else if (precisionType === 'float16') { - tolerance = 10; - } else { - tolerance = 1; - } - } else { - // interpolation mode is nearest-neighbor - tolerance = 0; - } - 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}}, - constant: {ULP: {float32: 2, float16: 2, int32: 0, uint32: 0, int64: 0, int8: 0, uint8: 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}}, - gelu: {ULP: {float32: 18, float16: 18}}, - 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}}, - l2Pool2d: {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}}, - resample2d: {ULP: {float32: getResample2dPrecisionTolerance, float16: getResample2dPrecisionTolerance}}, - 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}}, - triangular: {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 + * https://www.w3.org/TR/webnn/#enumdef-mloperanddatatype * @return {Number} A 64-bit signed integer. */ const getBitwise = (value, dataType) => { @@ -508,23 +170,27 @@ const getBitwise = (value, dataType) => { }; /** - * 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. + * 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 {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 + * https://www.w3.org/TR/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}`); + 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]) { @@ -544,1734 +210,333 @@ const assert_array_approx_equals_ulp = (actual, expected, nulp, dataType, descri } 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`); + + // if true, invoke assert_true() in failure case + // if false, it's expected, not invoke assert_true() in success case to + // prevent spammy output + if (distance > nulp) { + assert_true( + false, + `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 {String} operatorName * @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) { - const suboutputResource = getNamedResource(expected, operandName); - outputData = outputs[operandName]; - // If data is scalar and shape is not, it means it's expecting to be - // filled by the scalar value. Also limit the array size so it doesn't - // timeout. - if (typeof (suboutputResource.data) === 'number' && - suboutputResource.shape && sizeOfShape(suboutputResource.shape) > 1) { - const size = Math.min( - kMaximumIndexToValidate, sizeOfShape(suboutputResource.shape)); - suboutputResource.data = [ - new Array(size).fill(suboutputResource.data), suboutputResource.type - ]; - outputData = outputData.subarray(0, kMaximumIndexToValidate); - } - assert_array_equals( - namedOutputOperands[operandName].shape(), - suboutputResource.shape ?? []); - tolerance = getPrecisonTolerance(operationName, metricType, resources); - doAssert(operationName, outputData, suboutputResource.data, tolerance, suboutputResource.type, metricType) - } - } else { - assert_array_equals(namedOutputOperands[expected.name].shape(), expected.shape ?? []); - outputData = outputs[expected.name]; - // If data is scalar and shape is not, it means it's expecting to be filled - // by the scalar value. Also limit the array size so it doesn't timeout. - if (typeof (expected.data) === 'number' && expected.shape && - sizeOfShape(expected.shape) > 1) { - const size = - Math.min(kMaximumIndexToValidate, sizeOfShape(expected.shape)); - expected.data = new Array(size).fill(expected.data); - outputData = outputData.subarray(0, kMaximumIndexToValidate); - } - 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 - * @param {String} dataType - optional dataType if it's different from resources - * @returns {MLOperand} A constant operand - */ -const createConstantOperand = (builder, resources, dataType = null) => { - if (!dataType) { - dataType = resources.type; - } - - const bufferView = (typeof (resources.data) === 'number' && - sizeOfShape(resources.shape) > 1) ? - new TypedArrayDict[dataType](sizeOfShape(resources.shape)) - .fill(resources.data) : - new TypedArrayDict[dataType](resources.data); - return builder.constant( - {dataType: dataType, type: dataType, dimensions: resources.shape}, - bufferView); -}; - -/** - * Create single input operands for a graph. - * @param {MLContext} context - A ML context - * @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 = - (context, builder, resources, inputOperandName) => { - inputOperandName ||= Object.keys(resources.inputs)[0]; - const inputResources = resources.inputs[inputOperandName]; - let operand; - let dataType = inputResources.type; - // If input data type is not supported on current platform, attempt to use - // a supported type to pass the data, then cast back to original type. - if (!context.opSupportLimits().input.dataTypes.includes( - inputResources.type)) { - const compatible_type = findCompatibleType( - inputResources.type, context.opSupportLimits().input.dataTypes); - if (compatible_type) { - inputResources.castedType = compatible_type; - dataType = compatible_type; - } + * @param {Number} toleranceValue + * @param {String} dataType - An operand type string, value: "float32", + * more types, please see: + * https://www.w3.org/TR/webnn/#enumdef-mloperanddatatype + */ +const doAssert = + (operatorName, actual, expected, metricType, toleranceValue, dataType) => { + const description = `test ${operatorName} ${dataType}`; + if (typeof expected === 'number') { + expected = [expected]; + actual = [actual]; } - if (resources.inputs[inputOperandName].hasOwnProperty('constant') && - resources.inputs[inputOperandName]['constant']) { - operand = createConstantOperand( - builder, resources.inputs[inputOperandName], dataType); + if (metricType === 'ULP') { + assert_array_approx_equals_ulp( + actual, expected, toleranceValue, dataType, description); + } else if (metricType === 'ATOL') { + assert_array_approx_equals( + actual, expected, toleranceValue, description); } else { - operand = builder.input(inputOperandName, { - dataType: dataType, - type: dataType, - dimensions: inputResources.shape - }); - } - if (inputResources.castedType) { - operand = builder.cast(operand, inputResources.type); - } - return operand; - }; - -/** - * Create multi input operands for a graph. - * @param {MLContext} context - A ML context - * @param {MLGraphBuilder} builder - A ML graph builder - * @param {Object} resources - Resources used for building a graph - * @returns {MLOperand[]} Input operands array - */ -const createMultiInputOperands = (context, builder, resources) => { - let inputOperands = []; - const inputOperandNameArray = Object.keys(resources.inputs); - inputOperandNameArray.forEach(inputOperandName => { - const operand = - createSingleInputOperand(context, builder, resources, inputOperandName); - inputOperands.push(operand); - }); - return inputOperands; -}; - -/** - * Build an operation which has a single input. - * @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 - * @returns {MLNamedOperands} - */ -const buildOperationWithSingleInput = - (operationName, context, builder, resources) => { - const namedOutputOperand = {}; - const inputOperand = - createSingleInputOperand(context, builder, resources); - let outputOperand = resources.options ? - builder[operationName](inputOperand, resources.options) : - builder[operationName](inputOperand); - if (!context.opSupportLimits().output.dataTypes.includes( - resources.expected.type)) { - const compatibleType = findCompatibleType( - resources.expected.type, - context.opSupportLimits().output.dataTypes); - outputOperand = builder.cast(outputOperand, compatibleType); - resources.expected.castedType = compatibleType; + throw new AssertionError( + `Tolerance Metric type '${metricType}' is not supported`); } - namedOutputOperand[resources.expected.name] = outputOperand; - return namedOutputOperand; }; /** - * Build an operation which has two inputs. - * @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 - * @returns {MLNamedOperands} + * Assert computed results be equal to expected data. + * @param {Object} toleranceFunc + * @param {Object. | + * Array[Object.]} actual + * @param {Object} graphResources - Resources used for building a graph */ -const buildOperationWithTwoInputs = - (operationName, context, builder, resources) => { - // For example: MLOperand matmul(MLOperand a, MLOperand b); - const namedOutputOperand = {}; - const [inputOperandA, inputOperandB] = - createMultiInputOperands(context, builder, resources); - let outputOperand = resources.options ? - builder[operationName]( - inputOperandA, inputOperandB, resources.options) : - builder[operationName](inputOperandA, inputOperandB); - if (!context.opSupportLimits().output.dataTypes.includes( - resources.expected.type)) { - const compatibleType = findCompatibleType( - resources.expected.type, - context.opSupportLimits().output.dataTypes); - outputOperand = builder.cast(outputOperand, compatibleType); - resources.expected.castedType = compatibleType; - } - namedOutputOperand[resources.expected.name] = outputOperand; - return namedOutputOperand; - }; +const assertResultsEquals = (toleranceFunc, actual, graphResources) => { + const operatorName = + graphResources.operators.map(operator => operator.name).join(' '); + const expectedOutputs = graphResources.expectedOutputs; + const toleranceInfo = toleranceFunc(graphResources); + const metricType = toleranceInfo.metricType; + const toleranceValue = toleranceInfo.value; + let outputData; -const buildBatchNorm = (operationName, context, builder, resources) => { - // MLOperand batchNormalization(MLOperand input, MLOperand mean, MLOperand variance, - // optional MLBatchNormalizationOptions options = {}); - const namedOutputOperand = {}; - const [inputOperand, meanOperand, varianceOperand] = - createMultiInputOperands(context, builder, resources); - const batchNormOptions = {...resources.options}; - if (batchNormOptions.scale) { - batchNormOptions.scale = createConstantOperand(builder, batchNormOptions.scale); - } - if (batchNormOptions.bias) { - batchNormOptions.bias = createConstantOperand(builder, batchNormOptions.bias); + for (let operandName in actual) { + const expectedSuboutput = expectedOutputs[operandName]; + outputData = actual[operandName]; + // If data is scalar and shape is not, it means it's expecting to be + // filled by the scalar value. Also limit the array size so it doesn't + // timeout. + if (typeof (expectedSuboutput.data) === 'number' && + expectedSuboutput.dimensions && + sizeOfShape(expectedSuboutput.dimensions) > 1) { + const size = Math.min( + kMaximumIndexToValidate, sizeOfShape(expectedSuboutput.dimensions)); + expectedSuboutput.data = new Array(size).fill(expectedSuboutput.data); + outputData = outputData.subarray(0, kMaximumIndexToValidate); + } + doAssert( + operatorName, outputData, expectedSuboutput.data, metricType, + toleranceValue, expectedSuboutput.dataType); } - // invoke builder.batchNormalization() - namedOutputOperand[resources.expected.name] = - builder[operationName](inputOperand, meanOperand, varianceOperand, batchNormOptions); - return namedOutputOperand; -}; - -const buildCast = (operationName, context, builder, resources) => { - // MLOperand cast(MLOperand input, MLOperandDataType type); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - // invoke builder.cast() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.type); - return namedOutputOperand; -}; - -const buildArgMinMax = (operationName, context, builder, resources) => { - // MLOperand argMin/argMax(MLOperand input, unsigned long axis, optional MLArgMinMaxOptions options = {}); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - let argMinMaxOptions = {...resources.options}; - // invoke builder.argMin/argMax() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.axis, argMinMaxOptions); - return namedOutputOperand; }; -const buildConcat = (operationName, context, builder, resources) => { - // MLOperand concat(sequence inputs, unsigned long axis); - const namedOutputOperand = {}; - const inputOperands = []; +const createOperand = (context, builder, operandName, resources) => { 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}); + const descriptor = resources.descriptor; + const dataType = descriptor.dataType; + + // If input data type is not supported on current platform, attempt to use + // a supported type to pass the data, then cast back to original type. + if (!context.opSupportLimits().input.dataTypes.includes(dataType)) { + const compatibleType = + findCompatibleType(dataType, context.opSupportLimits().input.dataTypes); + if (compatibleType) { + descriptor.castedType = compatibleType; + descriptor.dataType = compatibleType; + } + } + + operand = resources.constant ? + builder.constant( + descriptor, + getTypedArrayData( + descriptor.dataType, sizeOfShape(descriptor.dimensions), + resources.data)) : + builder.input(operandName, descriptor); + + if (descriptor.castedType) { + operand = builder.cast(operand, dataType); + } + + return operand; +}; + +const prepareInputsForGraph = (inputs, resources) => { + for (let operandName of Object.keys(resources)) { + const inputOperandResources = resources[operandName]; + if (!inputOperandResources.constant) { + inputs[operandName] = getTypedArrayData( + inputOperandResources.descriptor.castedType ? + inputOperandResources.descriptor.castedType : + inputOperandResources.descriptor.dataType, + sizeOfShape(inputOperandResources.descriptor.dimensions), + inputOperandResources.data); + } + } +}; + +const prepareOutputsForGraph = (outputs, resources) => { + for (let operandName of Object.keys(resources)) { + const descriptor = resources[operandName].descriptor; + const dataType = + descriptor.castedType ? descriptor.castedType : descriptor.dataType; + outputs[operandName] = + new TypedArrayDict[dataType](sizeOfShape(descriptor.dimensions)); + } +}; + +/** + * This function is to compile the constructed graph and compute. + * @param {MLContext} context + * @param {MLGraphBuilder} builder + * @param {{ + * inputs: Map|Number, + * descriptor: MLOperandDescriptor, + * constant?: Boolean + * }>, + * operators: Array.<{ + * name: String, + * arguments: Array.> , + * outputs: Array.|String + * }>, + * expectedOutputs: Map|Number, + * descriptor: MLOperandDescriptor, + * }> + * }} graphResources - Resources used for building a graph + * @returns A Promise of MLComputeResult. + */ +const buildGraphAndCompute = async (context, builder, graphResources) => { + let outputOperands; + const graphInputs = graphResources.inputs; + const graphOperators = graphResources.operators; + + if (graphOperators.length === 1) { + // For a test graph with a single operator + const argumentArray = []; + + for (const argument of graphOperators[0].arguments) { + for (const argumentName in argument) { + if (argumentName !== 'options') { + if (graphInputs.hasOwnProperty(argument[argumentName])) { + const operandName = argument[argumentName]; + const operand = createOperand( + context, builder, operandName, graphInputs[operandName]); + argumentArray.push(operand); + } else { + argumentArray.push(argument[argumentName]); + } + } else { + for (const [optionalArgumentName, value] of Object.entries( + argument['options'])) { + if (typeof value === 'string' && + graphInputs.hasOwnProperty(value)) { + const operandName = value; + const operand = createOperand( + context, builder, operandName, graphInputs[operandName]); + argument['options'][optionalArgumentName] = operand; + } + } + argumentArray.push(argument['options']); + } + } } - inputOperands.push(operand); - } - // invoke builder.concat() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperands, resources.axis); - return namedOutputOperand; -}; - -const buildConstantRange = (operationName, context, builder, resources) => { - const namedOutputOperand = {}; - // invoke builder.constant(start, step, outputShape, type) - namedOutputOperand[resources.expected.name] = builder[operationName](resources.inputs.start, resources.inputs.step, resources.outputShape, resources.type); - return namedOutputOperand; -}; - -const buildConvTranspose2d = (operationName, context, builder, resources) => { - // MLOperand convTranspose2d(MLOperand input, MLOperand filter, optional MLConvTranspose2dOptions options = {}); - const namedOutputOperand = {}; - const [inputOperand, filterOperand] = - createMultiInputOperands(context, builder, resources); - let convTranspose2dOptions = {...resources.options}; - if (convTranspose2dOptions.bias) { - convTranspose2dOptions.bias = createConstantOperand(builder, convTranspose2dOptions.bias); + outputOperands = builder[graphOperators[0].name](...argumentArray); + } else { + // For a test graph with multiple operators + // TODO: https://issues.chromium.org/issues/333756077 } - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, filterOperand, convTranspose2dOptions); - return namedOutputOperand; -}; -const buildConv2d = (operationName, context, builder, resources) => { - // MLOperand conv2d(MLOperand input, MLOperand filter, optional MLConv2dOptions options = {}); - const namedOutputOperand = {}; - const [inputOperand, filterOperand] = - createMultiInputOperands(context, builder, resources); - let conv2dOptions = {...resources.options}; - if (conv2dOptions.bias) { - conv2dOptions.bias = createConstantOperand(builder, conv2dOptions.bias); + if (!Array.isArray(outputOperands)) { + outputOperands = [outputOperands]; } - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, filterOperand, conv2dOptions); - return namedOutputOperand; -}; -const buildGemm = (operationName, context, builder, resources) => { - // MLOperand gemm(MLOperand a, MLOperand b, optional MLGemmOptions options = {}); - const namedOutputOperand = {}; - const [inputOperandA, inputOperandB] = - createMultiInputOperands(context, 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])); + for (let i = 0; i < outputOperands.length; ++i) { + const expectedDescriptor = + graphResources + .expectedOutputs[Object.keys(graphResources.expectedOutputs)[i]] + .descriptor; + if (!context.opSupportLimits().output.dataTypes.includes( + expectedDescriptor.dataType)) { + const compatibleType = findCompatibleType( + expectedDescriptor.dataType, + context.opSupportLimits().output.dataTypes); + outputOperands[i] = builder.cast(outputOperands[i], compatibleType); + expectedDescriptor.castedType = compatibleType; } } - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperandA, inputOperandB, gemmOptions); - return namedOutputOperand; -}; -const buildLayerNorm = (operationName, context, builder, resources) => { - // MLOperand layerNormalization(MLOperand input, optional MLLayerNormalizationOptions options = {}); - // MLOperand instanceNormalization(MLOperand input, optional MLInstanceNormalizationOptions options = {}); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - const layerNormOptions = {...resources.options}; - if (layerNormOptions.scale) { - layerNormOptions.scale = createConstantOperand(builder, layerNormOptions.scale); - } - if (layerNormOptions.bias) { - layerNormOptions.bias = createConstantOperand(builder, layerNormOptions.bias); + const outputNameArray = Object.keys(graphResources.expectedOutputs); + for (let i = 0; i < outputOperands.length; ++i) { + assertDescriptorsEquals( + outputOperands[i], + graphResources.expectedOutputs[outputNameArray[i]].descriptor); } - // invoke builder.layerNormalization() or builder.instanceNormalization() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, layerNormOptions); - return namedOutputOperand; -}; -const buildPad = (operationName, context, builder, resources) => { - // MLOperand pad(MLOperand input, sequence beginningPadding, sequence endingPadding, optional MLPadOptions options = {}); const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - // invoke builder.pad() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.beginningPadding, resources.endingPadding, resources.options); - return namedOutputOperand; -}; + outputNameArray.forEach( + (name, index) => namedOutputOperand[name] = outputOperands[index]); -const buildReshape = (operationName, context, builder, resources) => { - // MLOperand reshape(MLOperand input, sequence newShape); - // MLOperand expand(MLOperand input, sequence newShape); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - // invoke builder.reshape() or builder.expand() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.newShape); - return namedOutputOperand; -}; + // Compile the constructed graph. + const graph = await builder.build(namedOutputOperand); -const buildSlice = (operationName, context, builder, resources) => { - // MLOperand slice(MLOperand input, sequence starts, sequence sizes); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - // invoke builder.slice() - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.starts, resources.sizes); - return namedOutputOperand; -}; + const inputs = {}; + prepareInputsForGraph(inputs, graphInputs); -const buildSoftmax = (operationName, context, builder, resources) => { - // MLOperand softmax(MLOperand input, [EnforceRange] unsigned long axis); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, builder, resources); - if (resources.axis !== undefined) { - // invoke builder.softmax(input, axis) - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand, resources.axis); - } else { - // invoke builder.softmax(input) - namedOutputOperand[resources.expected.name] = builder[operationName](inputOperand); - } - return namedOutputOperand; -}; + const outputs = {}; + prepareOutputsForGraph(outputs, graphResources.expectedOutputs); -const buildSplit = (operationName, context, builder, resources) => { - // sequence split(MLOperand input, - // (unsigned long or sequence) splits, - // optional MLSplitOptions options = {}); - const namedOutputOperand = {}; - const inputOperand = createSingleInputOperand(context, 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; -}; + // Execute the compiled graph. + const result = await context.compute(graph, inputs, outputs); + return result; +}; + +const getConv2dPrecisionTolerance = (graphResources) => { + // number of reduced input elements multiplied by filter and summed (a sliding + // dot product like pooling) + const operatorResources = graphResources.operators[0]; + const operatorName = operatorResources.name; + const args = operatorResources.arguments; + const inputShape = graphResources.inputs[args[0][Object.keys(args[0])[0]]] + .descriptor.dimensions; + const filterShape = graphResources.inputs[args[1][Object.keys(args[1])[0]]] + .descriptor.dimensions; + const options = + args.length === 3 ? {...args[2][Object.keys(args[2])[0]]} : {}; + 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]; + const groups = options.groups ? options.groups : 1; + + if (options.inputLayout) { + if (!['nchw', 'nhwc'].includes(options.inputLayout)) { + throw new Error(`Unknown inputLayout ${options.inputLayout}`); + } + inputChannels = + options.inputLayout === 'nchw' ? inputChannels : inputShape[3]; + } + if (options.filterLayout) { + let filterLayouts = ['oihw', 'hwio', 'ohwi', 'ihwo']; // default for conv2d + if (operatorName === 'convTranspose2d') { + filterLayouts = ['iohw', 'hwoi', 'ohwi']; + } + if (!filterLayouts.includes(options.filterLayout)) { + throw new Error(`Unknown 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 buildWhere = (operationName, context, builder, resources) => { - // MLOperand where(MLOperand condition, MLOperand trueValues, MLOperand falseValues); - const namedOutputOperand = {}; - const [conditionOperand, trueValuesOperand, falseValuesOperand] = - createMultiInputOperands(context, builder, resources); - // invoke builder.where() - namedOutputOperand[resources.expected.name] = builder[operationName](conditionOperand, trueValuesOperand, falseValuesOperand); - return namedOutputOperand; + const tolerance = filterWidth * filterHeight * (inputChannels / groups) * 2; + const toleranceValueDict = {float32: tolerance, float16: tolerance}; + const expectedDataType = + getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs); + return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]}; }; -/** - * Build a graph. - * @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 - * @returns [namedOperands, inputs, outputs] - */ -const buildGraph = (operationName, context, builder, resources, buildFunc) => { - const namedOperands = buildFunc(operationName, context, 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.castedType ? subInput.castedType : subInput.type, - sizeOfShape(subInput.shape), subInput.data); - } - } - } else { - for (let inputName in resources.inputs) { - const subTestByName = resources.inputs[inputName]; - if (!subTestByName.hasOwnProperty('constant') || !subTestByName.constant) { - inputs[inputName] = getTypedArrayData( - subTestByName.castedType ? subTestByName.castedType : - subTestByName.type, - sizeOfShape(subTestByName.shape), 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]; - const expectedType = resources.expected.castedType ? - resources.expected.castedType : - resources.expected.type; - outputs[resources.expected.name] = - new TypedArrayDict[expectedType](sizeOfShape(shape)); - } - return [namedOperands, inputs, outputs]; +const getExpectedDataTypeOfSingleOutput = (expectedOutput) => { + const expectedDescriptor = + expectedOutput[Object.keys(expectedOutput)[0]].descriptor; + const dataType = expectedDescriptor.castedType ? + expectedDescriptor.castedType : + expectedDescriptor.dataType; + return dataType; }; -/** - * Build a graph, 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, context, builder, resources, buildFunc); - // compile the graph up to the output operand - const graph = await builder.build(namedOutputOperands); - // execute the compiled graph - const result = await context.compute(graph, inputs, outputs); - checkResults(operationName, namedOutputOperands, result.outputs, resources); -}; - -const variant = location.search.substring(1); -const contextOptions = kContextOptionsForVariant[variant]; - -/** - * Checks if MLBuffer is implemented or not. - * @param {MLContext} ml_context - A ML context to test for MLBuffer support. - * @returns {Boolean} True if MLBuffer is supported; otherwise, False. - */ -const isMLBufferSupported = - (ml_context) => { - return ( - createBuffer(ml_context, {dataType: 'int32', dimensions: [2, 2]}) !== - undefined); - } - -/** - * Run WebNN operation tests. - * @param {(String[]|String)} operationName - An operation name array or an - * operation name - * @param {Function} buildFunc - A build function for an operation - */ -const testWebNNOperation = (operationName, buildFunc) => { - let operationNameArray; - if (typeof operationName === 'string') { - operationNameArray = [operationName]; - } else if (Array.isArray(operationName)) { - operationNameArray = operationName; - } - - let context; - operationNameArray.forEach((subOperationName) => { - const tests = loadTests(subOperationName); - promise_setup(async () => { - let supported = false; - try { - context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - }); - for (const subTest of tests) { +const webnn_conformance_test = + (buildGraphAndComputeFunc, toleranceFunc, testResources) => { promise_test(async () => { + let context; + try { + context = await navigator.ml.createContext(contextOptions); + } catch (e) { + throw new AssertionError( + `Unable to create context for ${variant} variant. ${e}`); + } const builder = new MLGraphBuilder(context); - await run(subOperationName, context, builder, subTest, buildFunc); - }, `${subTest.name}`); - } - }); -}; - -/** - * WebNN parallel compute operation test. - */ -const testParallelCompute = () => { - let ml_context; - let ml_graph; - - promise_setup(async () => { - let supported = false; - try { - ml_context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - // Construct a simple graph: A = B * 2. - const builder = new MLGraphBuilder(ml_context); - const operandType = {dataType: 'float32', dimensions: [1]}; - const input_operand = builder.input('input', operandType); - const const_operand = builder.constant(operandType, Float32Array.from([2])); - const output_operand = builder.mul(input_operand, const_operand); - ml_graph = await builder.build({'output': output_operand}); - }); - - promise_test(async () => { - const test_inputs = [1, 2, 3, 4]; - - const actual_outputs = await Promise.all(test_inputs.map(async (input) => { - let inputs = {'input': Float32Array.from([input])}; - let outputs = {'output': new Float32Array(1)}; - ({inputs, outputs} = await ml_context.compute(ml_graph, inputs, outputs)); - return outputs.output[0]; - })); - - const expected_outputs = [2, 4, 6, 8]; - assert_array_equals(actual_outputs, expected_outputs); - }); -}; - -/** - * Run WebNN conformance tests by specified operation. - * @param {(String[]|String)} operationName - An operation name array or an - * operation name - * @param {Function} buildFunc - A build function for an operation - */ -const runWebNNConformanceTests = (operationName, buildFunc) => { - // Link to https://github.com/web-platform-tests/wpt/pull/44883 - // Check navigator.ml is defined before trying to run WebNN tests - if (navigator.ml) { - testWebNNOperation(operationName, buildFunc); - } else { - // Show indication to users why the test failed - test( - () => assert_not_equals( - navigator.ml, undefined, 'ml property is defined on navigator')); - } -}; - -// 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; -}; - - -/** - * WebNN buffer creation. - * @param {MLContext} context - the context used to create the buffer. - * @param {MLBufferDescriptor} bufferDescriptor - intended specs of the buffer. - * @returns {MLBuffer} the created buffer. - */ -const createBuffer = (context, bufferDescriptor) => { - let buffer; - try { - buffer = context.createBuffer(bufferDescriptor); - assert_equals( - buffer.dataType, bufferDescriptor.dataType, - 'buffer data types do not match'); - assert_array_equals( - buffer.shape, bufferDescriptor.dimensions, - 'buffer shapes do not match'); - } catch (e) { - assert_true(e instanceof DOMException); - assert_equals(e.name, "NotSupportedError"); - } - return buffer; -}; - -/** - * WebNN destroy buffer twice test. - * @param {String} testName - The name of the test operation. - */ -const testDestroyWebNNBuffer = (testName) => { - let context; - let buffer; - promise_setup(async () => { - let supported = false; - try { - context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - buffer = createBuffer(context, {dataType: 'int32', dimensions: [2, 3]}); - }); - promise_test(async () => { - // MLBuffer is not supported for this deviceType. - if (buffer === undefined) { - return; - } - buffer.destroy(); - buffer.destroy(); - }, `${testName}`); -}; - -/** - * WebNN create buffer test. - * @param {String} testName - The name of the test operation. - * @param {MLBufferDescriptor} bufferDescriptor - The intended buffer specs. - */ -const testCreateWebNNBuffer = (testName, bufferDescriptor) => { - let context; - - promise_setup(async () => { - let supported = false; - try { - context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - }); - promise_test(async () => { - createBuffer(context, bufferDescriptor); - }, `${testName} / ${bufferDescriptor.dataType}`); -}; - -/** - * Same as above, but expect creating the buffer to fail. - * @param {String} testName - The name of the test operation. - * @param {MLBufferDescriptor} bufferDescriptor - The intended buffer specs. - */ -const testCreateWebNNBufferFails = (testName, bufferDescriptor) => { - let context; - - promise_setup(async () => { - let supported = false; - try { - context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - }); - promise_test(async () => { - assert_throws_js(TypeError, () => context.createBuffer(bufferDescriptor)); - }, `${testName} / ${bufferDescriptor.dataType}`); -}; - - -/** - * Asserts the buffer data in MLBuffer matches expected. - * @param {MLContext} ml_context - The context used to create the buffer. - * @param {MLBuffer} ml_buffer - The buffer to read and compare data. - * @param {Array} expected - Array of the expected data in the buffer. - */ -const assert_buffer_data_equals = async (ml_context, ml_buffer, expected) => { - const actual = await ml_context.readBuffer(ml_buffer); - assert_array_equals( - new expected.constructor(actual), expected, - 'Read buffer data equals expected data.'); -}; - -/** - * WebNN write buffer operation test. - * @param {String} testName - The name of the test operation. - */ -const testWriteWebNNBuffer = (testName) => { - let ml_context; - promise_setup(async () => { - let supported = false; - try { - ml_context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - }); - - promise_test(async () => { - const descriptor = {dataType: 'int32', dimensions: [1]}; - let ml_buffer = createBuffer(ml_context, descriptor); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - const bufferByteLength = sizeOfDescriptor(descriptor); - let array_buffer = new ArrayBuffer(bufferByteLength); - - // Writing with a size that goes past that source buffer length. - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(array_buffer), /*srcOffset=*/ 0, - /*srcSize=*/ bufferByteLength + 1)); - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(array_buffer), /*srcOffset=*/ 3, - /*srcSize=*/ bufferByteLength)); - - // Writing with a source offset that is out of range of the source size. - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(array_buffer), - /*srcOffset=*/ bufferByteLength + 1)); - - // Writing with a source offset that is out of range of implicit copy size. - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(array_buffer), - /*srcOffset=*/ bufferByteLength + 1, /*srcSize=*/ undefined)); - - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(array_buffer), /*srcOffset=*/ undefined, - /*srcSize=*/ bufferByteLength + 1)); - - assert_throws_js( - TypeError, - () => ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE, 0xEE]))); - }, `${testName} / error`); - - promise_test(async () => { - const descriptor = {dataType: 'int32', dimensions: [2, 2]}; - let ml_buffer = createBuffer(ml_context, descriptor); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Writing data to a destroyed MLBuffer should throw. - ml_buffer.destroy(); - - assert_throws_dom( - 'InvalidStateError', - () => ml_context.writeBuffer( - ml_buffer, new Uint8Array(sizeOfDescriptor(descriptor)))); - }, `${testName} / destroy`); - - promise_test(async () => { - const bufferDescriptor = {dataType: 'int32', dimensions: [2, 3]}; - let ml_buffer = createBuffer(ml_context, bufferDescriptor); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - let another_ml_context = await navigator.ml.createContext(contextOptions); - let another_ml_buffer = createBuffer(another_ml_context, bufferDescriptor); - - let input_data = - new Uint8Array(sizeOfDescriptor(bufferDescriptor)).fill(0xAA); - assert_throws_js( - TypeError, () => ml_context.writeBuffer(another_ml_buffer, input_data)); - assert_throws_js( - TypeError, () => another_ml_context.writeBuffer(ml_buffer, input_data)); - }, `${testName} / context_mismatch`); -}; - -/** - * WebNN read buffer operation test. - * @param {String} testName - The name of the test operation. - */ -const testReadWebNNBuffer = (testName) => { - let ml_context; - promise_setup(async () => { - let supported = false; - try { - ml_context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - }); - - promise_test(async t => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [2, 2]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Reading a destroyed MLBuffer should reject. - ml_buffer.destroy(); - - await promise_rejects_dom( - t, 'InvalidStateError', ml_context.readBuffer(ml_buffer)); - }, `${testName} / destroy`); - - promise_test(async () => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [1]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Initialize the buffer. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); - - ml_context.writeBuffer(ml_buffer, Uint32Array.from([0xBBBBBBBB])); - await assert_buffer_data_equals( - ml_context, ml_buffer, Uint32Array.from([0xBBBBBBBB])); - ; - }, `${testName} / full_size`); - - promise_test(async () => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [1]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Initialize the buffer. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); - - // Writing to the remainder of the buffer from source offset. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xCC, 0xCC, 0xBB, 0xBB]), - /*srcOffset=*/ 2); - await assert_buffer_data_equals( - ml_context, ml_buffer, Uint8Array.from([0xBB, 0xBB, 0xAA, 0xAA])); - }, `${testName} / src_offset_only`); - - promise_test(async () => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [1]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Initialize the buffer. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); - - // Writing with both a source offset and size. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xDD, 0xDD, 0xCC, 0xDD]), - /*srcOffset=*/ 2, /*srcSize=*/ 1); - await assert_buffer_data_equals( - ml_context, ml_buffer, Uint8Array.from([0xCC, 0xAA, 0xAA, 0xAA])); - }, `${testName} / src_offset_and_size`); - - promise_test(async () => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [1]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - // Initialize the buffer. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xAA, 0xAA, 0xAA, 0xAA])); - - // Using an offset allows a larger source buffer to fit. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE, 0xEE]), - /*srcOffset=*/ 1); - await assert_buffer_data_equals( - ml_context, ml_buffer, Uint8Array.from([0xEE, 0xEE, 0xEE, 0xEE])); - }, `${testName} / larger_src_data`); - - promise_test(async () => { - let ml_buffer = - createBuffer(ml_context, {dataType: 'int32', dimensions: [1]}); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - const input_data = [0xAA, 0xAA, 0xAA, 0xAA]; - - // Writing with a source offset of undefined should be treated as 0. - ml_context.writeBuffer( - ml_buffer, Uint8Array.from(input_data), /*srcOffset=*/ undefined, - /*srcSize=*/ input_data.length); - await assert_buffer_data_equals( - ml_context, ml_buffer, Uint8Array.from(input_data)); - }, `${testName} / no_src_offset`); - - promise_test(async t => { - const bufferDescriptor = {dataType: 'int32', dimensions: [2, 3]}; - let ml_buffer = createBuffer(ml_context, bufferDescriptor); - - // MLBuffer was unsupported for the deviceType. - if (ml_buffer === undefined) { - return; - } - - let another_ml_context = await navigator.ml.createContext(contextOptions); - let another_ml_buffer = createBuffer(another_ml_context, bufferDescriptor); - - await promise_rejects_js( - t, TypeError, ml_context.readBuffer(another_ml_buffer)); - await promise_rejects_js( - t, TypeError, another_ml_context.readBuffer(ml_buffer)); - }, `${testName} / context_mismatch`); -}; - -/** - * WebNN dispatch buffer operation test. - * @param {String} testName - The name of the test operation. - */ -const testDispatchWebNNBuffer = (testName) => { - let ml_context; - let ml_graph; - const shape = [3, 5]; - let inputs = {}; - let outputs = {}; - promise_setup(async () => { - let supported = false; - try { - ml_context = await navigator.ml.createContext(contextOptions); - supported = true; - } catch (e) { - } - assert_implements( - supported, `Unable to create context for ${variant} variant`); - // Construct a simple graph: A = B + C, with two outputs. - const builder = new MLGraphBuilder(ml_context); - const descriptor = {dataType: 'float32', dimensions: shape}; - const lhs_operand = builder.input('lhs', descriptor); - const rhs_operand = builder.input('rhs', descriptor); - const output_1_operand = builder.add(lhs_operand, rhs_operand); - const output_2_operand = builder.add(lhs_operand, rhs_operand); - ml_graph = await builder.build( - {'output1': output_1_operand, 'output2': output_2_operand}); - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - inputs = { - 'lhs': ml_context.createBuffer(descriptor), - 'rhs': ml_context.createBuffer(descriptor), - }; - outputs = { - 'output1': ml_context.createBuffer(descriptor), - 'output2': ml_context.createBuffer(descriptor), + const result = await buildGraphAndComputeFunc( + context, builder, testResources.graph); + assertResultsEquals(toleranceFunc, result.outputs, testResources.graph); + }, testResources.name); }; - }); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - let another_ml_context = await navigator.ml.createContext(contextOptions); - - // Control case, same context. - ml_context.dispatch(ml_graph, inputs, outputs); - - // Test the wrong context being used for inputs. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': another_ml_context.createBuffer( - getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': inputs['rhs'], - }, - outputs)); - - // Test the wrong context being used for outputs. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': another_ml_context.createBuffer( - getDescriptorFromBuffer(outputs['output1'])), - 'output2': outputs['output2'], - })); - }, `${testName} / context_mismatch`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - // Control case, valid buffers. - ml_context.dispatch(ml_graph, inputs, outputs); - - // Input is a different shape. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': ml_context.createBuffer({ - dataType: inputs['lhs'].dataType, - // Input rank is too high. - dimensions: inputs['lhs'].shape.concat([2]) - }), - 'rhs': inputs['rhs'], - }, - outputs)); - - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': inputs['lhs'], - 'rhs': ml_context.createBuffer({ - dataType: inputs['rhs'].dataType, - // Input rank is too low. - dimensions: inputs['rhs'].shape.slice(1) - }), - }, - outputs)); - - // Output is a different shape. Dimension value is too large. - let output1WrongShape = [...outputs['output1'].shape]; - output1WrongShape[0] += 2; - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': ml_context.createBuffer({ - dataType: outputs['output1'].dataType, - dimensions: output1WrongShape - }), - 'output2': outputs['output2'], - })); - - // Output is a different shape. Dimension value is too small. - let output2WrongShape = [...outputs['output2'].shape]; - output2WrongShape[1] -= 1; - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'], - 'output2': ml_context.createBuffer({ - dataType: outputs['output2'].dataType, - dimensions: output2WrongShape - }), - })); - }, `${testName} / invalid shape`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - // Control case, valid buffers. - ml_context.dispatch(ml_graph, inputs, outputs); - - // Inputs are a different data type. - const inputWrongDataType = 'int32'; - assert_not_equals(inputs['lhs'].dataType, inputWrongDataType); - assert_not_equals(inputs['rhs'].dataType, inputWrongDataType); - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': ml_context.createBuffer({ - dataType: inputWrongDataType, - dimensions: inputs['lhs'].shape - }), - 'rhs': inputs['rhs'], - }, - outputs)); - - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': inputs['lhs'], - 'rhs': ml_context.createBuffer({ - dataType: inputWrongDataType, - dimensions: inputs['rhs'].shape - }), - }, - outputs)); - - // Outputs are a different data type. - const outputWrongDataType = 'int32'; - assert_not_equals(outputs['output1'].dataType, outputWrongDataType); - assert_not_equals(outputs['output2'].dataType, outputWrongDataType); - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': ml_context.createBuffer({ - dataType: outputWrongDataType, - dimensions: outputs['output1'].shape - }), - 'output2': outputs['output2'], - })); - - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'], - 'output2': ml_context.createBuffer({ - dataType: outputWrongDataType, - dimensions: outputs['output2'].shape - }), - })); - }, `${testName} / invalid data type`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - // Control case, valid names. - ml_context.dispatch(ml_graph, inputs, outputs); - - // No names is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, {}, {})); - - // Input name is invalid. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'a_different_input_name': inputs['lhs'], - 'rhs': inputs['rhs'], - }, - outputs)); - - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': inputs['lhs'], - 'a_different_input_name': inputs['rhs'], - }, - outputs)); - - // Output name is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'a_different_output_name': outputs['output1'], - 'output2': outputs['output2'], - })); - - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'], - 'a_different_output_name': outputs['output2'], - })); - - // Too few named inputs is invalid. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': inputs['lhs'], - }, - outputs)); - - // Too many named inputs is invalid. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': inputs['lhs'], - 'rhs': inputs['rhs'], - 'a_different_input_name': ml_context.createBuffer( - getDescriptorFromBuffer(inputs['rhs'])), - }, - outputs)); - - // Too few named outputs is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'] - })); - - // Too many named outputs is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'], - 'output2': outputs['output2'], - 'a_different_output_name': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - })); - }, `${testName} / invalid_name`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - // Control case, valid buffers. - ml_context.dispatch(ml_graph, inputs, outputs); - - // Same buffer used as outputs more than once is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': outputs['output1'], - 'output2': outputs['output1'], - })); - - // Same buffer used as input and output is invalid. - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': inputs['lhs'], - 'output2': outputs['output2'], - })); - - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': outputs['output1'], - 'rhs': inputs['rhs'], - }, - outputs)); - - // Buffer that does not exist is invalid. - assert_throws_js( - TypeError, - () => ml_context.dispatch( - ml_graph, { - 'lhs': undefined, - 'rhs': inputs['rhs'], - }, - outputs)); - - assert_throws_js(TypeError, () => ml_context.dispatch(ml_graph, inputs, { - 'output1': undefined, - 'output2': outputs['output2'], - })); - }, `${testName} / invalid_buffer`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatch_inputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatch_1_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - const dispatch_2_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const input_data = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatch_inputs['lhs'], input_data); - ml_context.writeBuffer(dispatch_inputs['rhs'], input_data); - - // Output_1 = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatch_inputs, dispatch_1_outputs); - - // Output_2 = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatch_inputs, dispatch_2_outputs); - - await assert_buffer_data_equals( - ml_context, dispatch_1_outputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - - await assert_buffer_data_equals( - ml_context, dispatch_1_outputs['output2'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - - await assert_buffer_data_equals( - ml_context, dispatch_2_outputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - - await assert_buffer_data_equals( - ml_context, dispatch_2_outputs['output2'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - }, `${testName} / same_inputs`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatch_1_inputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatch_2_inputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatch_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const input_1_data = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatch_1_inputs['lhs'], input_1_data); - ml_context.writeBuffer(dispatch_1_inputs['rhs'], input_1_data); - - const input_2_data = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); - ml_context.writeBuffer(dispatch_2_inputs['lhs'], input_2_data); - ml_context.writeBuffer(dispatch_2_inputs['rhs'], input_2_data); - - // Output = LHS_1 + RHS_1 = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatch_1_inputs, dispatch_outputs); - - // Output = LHS_2 + RHS_2 = 2 + 2 = 4 - ml_context.dispatch(ml_graph, dispatch_2_inputs, dispatch_outputs); - - await assert_buffer_data_equals( - ml_context, dispatch_outputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(4.0)); - - await assert_buffer_data_equals( - ml_context, dispatch_outputs['output2'], - new Float32Array(sizeOfShape(shape)).fill(4.0)); - }, `${testName} / same_outputs`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatch_inputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatch_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const input_data = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatch_inputs['lhs'], input_data); - ml_context.writeBuffer(dispatch_inputs['rhs'], input_data); - - // Output = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatch_inputs, dispatch_outputs); - ml_context.dispatch(ml_graph, dispatch_inputs, dispatch_outputs); - - await assert_buffer_data_equals( - ml_context, dispatch_outputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - - await assert_buffer_data_equals( - ml_context, dispatch_outputs['output2'], - new Float32Array(sizeOfShape(shape)).fill(2.0)); - }, `${testName} / same_inputs_and_outputs`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatch_inputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatch_1_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - const dispatch_2_outputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const input_data = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatch_inputs['lhs'], input_data); - ml_context.writeBuffer(dispatch_inputs['rhs'], input_data); - - // Output_1 = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatch_inputs, dispatch_1_outputs); - - // Output_2 = Output_1_LHS + Output_1_RHS = 2 + 2 = 4 - ml_context.dispatch( - ml_graph, { - 'lhs': dispatch_1_outputs['output1'], - 'rhs': dispatch_1_outputs['output2'], - }, - dispatch_2_outputs); - - // Output_1 = Output_2_LHS + Output_2_RHS = 4 + 4 = 8 - ml_context.dispatch( - ml_graph, { - 'lhs': dispatch_2_outputs['output1'], - 'rhs': dispatch_2_outputs['output2'], - }, - dispatch_1_outputs); - - await assert_buffer_data_equals( - ml_context, dispatch_1_outputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(8)); - - await assert_buffer_data_equals( - ml_context, dispatch_1_outputs['output2'], - new Float32Array(sizeOfShape(shape)).fill(8)); - }, `${testName} / outputs_as_inputs`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - // Construct a simple graph: OUTPUT = LHS - RHS. - const builder = new MLGraphBuilder(ml_context); - const operandType = {dataType: 'float32', dimensions: shape}; - const lhsOperand = builder.input('lhs', operandType); - const rhsOperand = builder.input('rhs', operandType); - const graph = - await builder.build({'output': builder.sub(lhsOperand, rhsOperand)}); - - const lhsBuffer = - ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])); - const rhsBuffer = - ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])); - - const dispatchOutputs = { - 'output': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])) - }; - - // Initialize inputs - ml_context.writeBuffer( - lhsBuffer, new TypedArrayDict['float32'](sizeOfShape(shape)).fill(5.0)); - ml_context.writeBuffer( - rhsBuffer, new TypedArrayDict['float32'](sizeOfShape(shape)).fill(3.0)); - - // Output = LHS - RHS = 5 - 3 = 2 - ml_context.dispatch( - graph, { - 'lhs': lhsBuffer, - 'rhs': rhsBuffer, - }, - dispatchOutputs); - - await assert_buffer_data_equals( - ml_context, dispatchOutputs['output'], - new Float32Array(sizeOfShape(shape)).fill(2)); - - // Output = RHS - LHS = 3 - 5 = -2 - ml_context.dispatch( - graph, { - 'lhs': rhsBuffer, - 'rhs': lhsBuffer, - }, - dispatchOutputs); - - await assert_buffer_data_equals( - ml_context, dispatchOutputs['output'], - new Float32Array(sizeOfShape(shape)).fill(-2)); - }, `${testName} / same name diff input buffers`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatchInputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const outputBuffer1 = - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])); - const outputBuffer2 = - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])); - - // Initialize inputs - const inputData1 = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatchInputs['lhs'], inputData1); - ml_context.writeBuffer(dispatchInputs['rhs'], inputData1); - - // Output = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatchInputs, { - 'output1': outputBuffer1, - 'output2': outputBuffer2, - }); - - // Output = LHS + RHS = 2 + 2 = 4 - const inputData2 = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); - ml_context.writeBuffer(dispatchInputs['lhs'], inputData2); - ml_context.writeBuffer(dispatchInputs['rhs'], inputData2); - - ml_context.dispatch(ml_graph, dispatchInputs, { - 'output1': outputBuffer1, - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }); - - // Ensure the last dispatch() did not modify the original second output - // buffer. - await assert_buffer_data_equals( - ml_context, outputBuffer2, - new Float32Array(sizeOfShape(shape)).fill(2)); - }, `${testName} / same name diff outputs buffers`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatchInputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatchOutputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const inputData = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatchInputs['lhs'], inputData); - ml_context.writeBuffer(dispatchInputs['rhs'], inputData); - - // Output = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatchInputs, dispatchOutputs); - - // Check destroyed input buffers cannot be re-used in subsequent dispatches. - dispatchInputs['lhs'].destroy(); - dispatchInputs['lhs'] = - ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])); - - const newInputData = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); - ml_context.writeBuffer(dispatchInputs['lhs'], newInputData); - - // Output = LHS + RHS = 2 + 1 = 3 - ml_context.dispatch(ml_graph, dispatchInputs, dispatchOutputs); - - await assert_buffer_data_equals( - ml_context, dispatchOutputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(3)); - - dispatchInputs['rhs'].destroy(); - dispatchInputs['rhs'] = - ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])); - ml_context.writeBuffer(dispatchInputs['rhs'], newInputData); - - // Output = LHS + RHS = 2 + 2 = 4 - ml_context.dispatch(ml_graph, dispatchInputs, dispatchOutputs); - - await assert_buffer_data_equals( - ml_context, dispatchOutputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(4)); - }, `${testName} / same name diff inputs buffers destroy`); - - promise_test(async () => { - // MLBuffer was unsupported for the deviceType. - if (!isMLBufferSupported(ml_context)) { - return; - } - - const dispatchInputs = { - 'lhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['lhs'])), - 'rhs': ml_context.createBuffer(getDescriptorFromBuffer(inputs['rhs'])), - }; - - const dispatchOutputs = { - 'output1': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output1'])), - 'output2': - ml_context.createBuffer(getDescriptorFromBuffer(outputs['output2'])), - }; - - // Initialize inputs - const inputData = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(1.0); - ml_context.writeBuffer(dispatchInputs['lhs'], inputData); - ml_context.writeBuffer(dispatchInputs['rhs'], inputData); - - // Output = LHS + RHS = 1 + 1 = 2 - ml_context.dispatch(ml_graph, dispatchInputs, dispatchOutputs); - - // Check destroyed output buffers cannot be re-used in subsequent - // dispatches. - dispatchOutputs['output1'].destroy(); - dispatchOutputs['output1'] = ml_context.createBuffer( - getDescriptorFromBuffer(outputs['output1'])); - - const newInputData = - new TypedArrayDict['float32'](sizeOfShape(shape)).fill(2.0); - ml_context.writeBuffer(dispatchInputs['lhs'], newInputData); - - // Output = LHS + RHS = 2 + 1 = 3 - ml_context.dispatch(ml_graph, dispatchInputs, dispatchOutputs); - - await assert_buffer_data_equals( - ml_context, dispatchOutputs['output1'], - new Float32Array(sizeOfShape(shape)).fill(3)); - }, `${testName} / same name diff outputs buffers destroy`); -}; diff --git a/webnn/resources/utils_validation.js b/webnn/resources/utils_validation.js index 4bf21697ed3a3a..350e4548d6521f 100644 --- a/webnn/resources/utils_validation.js +++ b/webnn/resources/utils_validation.js @@ -1,6 +1,6 @@ 'use strict'; -// https://webmachinelearning.github.io/webnn/#enumdef-mloperanddatatype +// https://www.w3.org/TR/webnn/#enumdef-mloperanddatatype const allWebNNOperandDataTypes = [ 'float32', 'float16',