diff --git a/webnn/conformance_tests/reduce_l1.https.any.js b/webnn/conformance_tests/reduce_l1.https.any.js index 3bbb85b32c4f66..d2d39b3b67ae4c 100644 --- a/webnn/conformance_tests/reduce_l1.https.any.js +++ b/webnn/conformance_tests/reduce_l1.https.any.js @@ -611,6 +611,504 @@ const reduceL1Tests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceL1 float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [5.5078125], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [5.5078125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL1 float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [5.5078125], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}, {'options': {'axes': []}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [5.5078125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL1 float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + -98.8125, -57.65625, -57.09375, -6.69140625, -45.3125, + -86.6875, -74.75, -76.4375, -75.375, -18.21875, + -54.65625, -36.4375, -18.328125, -47.9375, -40.1875, + -15.828125, -48.875, -41.59375, -20.65625, -92.3125, + -46.28125, -80.5625, -25.5, -48.96875 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1215], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [993], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1344], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [{'input': 'reduceL1Input'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [142, 106.625, 175.375, 286.75, 169.375, 212.5], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL1 float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [258.5, 174.5, 102.1875, 134.5, 208, 215], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL1 float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [1093], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL1 float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': + {'data': [1093], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL1 float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': + [{'input': 'reduceL1Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [1093], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceL1 float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [108.4375, 315.5, 359.5, 309], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceL1 float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL1Input': { + 'data': [ + 5.5078125, 50.625, 1.677734375, 84.1875, 15.6640625, 52.90625, + 9.125, 28.9375, 12.5703125, 11.3984375, 86.9375, 64.5, + 71.3125, 76.375, 41.53125, 97.5625, 31.796875, 6.08984375, + 61.71875, 69.75, 38.90625, 52.28125, 22.3125, 99.0625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL1', + 'arguments': [ + {'input': 'reduceL1Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceL1Output' + }], + 'expectedOutputs': { + 'reduceL1Output': { + 'data': [108.4375, 315.5, 359.5, 309], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_l2.https.any.js b/webnn/conformance_tests/reduce_l2.https.any.js index d579158921c2c7..d8b9acd1cd2312 100644 --- a/webnn/conformance_tests/reduce_l2.https.any.js +++ b/webnn/conformance_tests/reduce_l2.https.any.js @@ -614,6 +614,499 @@ const reduceL2Tests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceL2 float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [4.859375], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [4.859375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [4.859375], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}, {'options': {'axes': []}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [4.859375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + -66.8125, -53, -59.59375, -46.15625, -49.59375, -12.8359375, + -88.0625, -75.5625, -50.78125, -36.96875, -26.34375, -58.90625, + -94.3125, -22.78125, -84.375, -60.46875, -41.46875, -92.875, + -85.0625, -30.234375, -47.34375, -25.265625, -78.125, -28.328125 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [292.5], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [274.5], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [300.5], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [{'input': 'reduceL2Input'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [122.375, 124.8125, 128.25, 128.125, 87.1875, 55.03125], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL2 float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [114.4375, 110.3125, 133.5, 64.9375, 128, 101.6875], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL2 float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [272], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceL2 float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': + {'data': [272], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceL2 float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': + [{'input': 'reduceL2Input'}, {'options': {'keepDimensions': true}}], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [272], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceL2 float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [138.625, 166.625, 149.875, 67.625], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceL2 float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceL2Input': { + 'data': [ + 4.859375, 88.25, 54.5, 64.75, 6.85546875, 91.375, + 41.875, 73.625, 35.3125, 48.34375, 82.375, 77.875, + 93.3125, 62.5, 60.28125, 13.234375, 20.53125, 53.4375, + 11.3203125, 64.75, 43.65625, 0.83740234375, 0.68505859375, 33.5 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceL2', + 'arguments': [ + {'input': 'reduceL2Input'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceL2Output' + }], + 'expectedOutputs': { + 'reduceL2Output': { + 'data': [138.625, 166.625, 149.875, 67.625], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_log_sum.https.any.js b/webnn/conformance_tests/reduce_log_sum.https.any.js index ab827e31452d3f..2afc4f698003ca 100644 --- a/webnn/conformance_tests/reduce_log_sum.https.any.js +++ b/webnn/conformance_tests/reduce_log_sum.https.any.js @@ -566,6 +566,493 @@ const reduceLogSumTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceLogSum float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [64.5625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [4.16796875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [64.5625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [4.16796875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSum float16 1D constant tensor all non-negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 1D tensor all non-negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSum float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': + {'data': [7.0625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceLogSum float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [{'input': 'reduceLogSumInput'}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [5.59375, 4.7734375, 5.3125, 5.25, 4.97265625, 5.375], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': + [{'input': 'reduceLogSumInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [ + 5.41015625, 5.3671875, 5.3984375, 4.65234375, 4.74609375, 5.56640625 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSum float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [7.0390625], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSum float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [5.7265625, 5.64453125, 5.453125, 5.7578125], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSum float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumInput': { + 'data': [ + 64.5625, 97.875, 26.53125, 79.8125, 50.40625, + 14.578125, 20.859375, 32.4375, 64.9375, 71.5625, + 11.140625, 55.09375, 43.78125, 13.828125, 97.375, + 35.5, 52.28125, 82.8125, 8.5703125, 0.83349609375, + 69.25, 3.853515625, 70.5625, 72 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSum', + 'arguments': [ + {'input': 'reduceLogSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumOutput' + }], + 'expectedOutputs': { + 'reduceLogSumOutput': { + 'data': [5.7265625, 5.64453125, 5.453125, 5.7578125], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_log_sum_exp.https.any.js b/webnn/conformance_tests/reduce_log_sum_exp.https.any.js index eecdf56f15b99a..1a9934e88c5c6b 100644 --- a/webnn/conformance_tests/reduce_log_sum_exp.https.any.js +++ b/webnn/conformance_tests/reduce_log_sum_exp.https.any.js @@ -627,6 +627,569 @@ const reduceLogSumExpTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceLogSumExp float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [0.79736328125], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [0.79736328125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [0.79736328125], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [0.79736328125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + -4.02734375, -9.4453125, -3.119140625, + -5.9453125, -0.3701171875, -4.3984375, + -6.60546875, -5.53515625, -7.36328125, + -1.9990234375, -9.09375, -8.6953125, + -8.4140625, -1.0107421875, -9.8125, + -9.7265625, -9.15625, -0.0016984939575195312, + -9.9609375, -5.9921875, -6.1796875, + -1.2333984375, -0.4423828125, -6.98828125 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [1.1669921875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': + {'data': [9.609375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceLogSumExp float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [0.7001953125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [{'input': 'reduceLogSumExpInput'}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [ + 8.5546875, 3.986328125, 5.52734375, 9.078125, 6.99609375, 9.7578125 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': + [{'input': 'reduceLogSumExpInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': + [4.671875, 9.078125, 8.5390625, 9.265625, 6.44921875, 8.9140625], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceLogSumExp float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [10.390625], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [8.5703125, 5.5, 9.75, 9.203125], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceLogSumExp float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceLogSumExpInput': { + 'data': [ + 0.79736328125, 5.046875, 8.5234375, 1.40625, + 0.11883544921875, 0.285888671875, 1.9326171875, 3.794921875, + 2.603515625, 4.9375, 4.5703125, 0.78662109375, + 0.210205078125, 9.0625, 4.1015625, 4.59765625, + 0.2548828125, 1.1591796875, 6.8046875, 5.234375, + 8.9140625, 9.1640625, 5.71875, 0.325439453125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceLogSumExp', + 'arguments': [ + {'input': 'reduceLogSumExpInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceLogSumExpOutput' + }], + 'expectedOutputs': { + 'reduceLogSumExpOutput': { + 'data': [8.5703125, 5.5, 9.75, 9.203125], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_max.https.any.js b/webnn/conformance_tests/reduce_max.https.any.js index 3695d1d0db2aed..9d7462140b4cb5 100644 --- a/webnn/conformance_tests/reduce_max.https.any.js +++ b/webnn/conformance_tests/reduce_max.https.any.js @@ -537,6 +537,444 @@ const reduceMaxTests = [ } } }, + + // float16 tests + { + 'name': 'reduceMax float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [32.15625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [32.15625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [32.15625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [32.15625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [{'input': 'reduceMaxInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [90.4375, 75.875, 95, 96.5625, 99.75, 20.25], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMax float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': + [{'input': 'reduceMaxInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [62.5, 96.5625, 99.75, -21.5625, 95, 37.28125], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMax float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [99.75], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMax float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': + {'data': [99.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMax float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [99.75], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMax float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [90.4375, 95, 96.5625, 99.75], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMax float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMaxInput': { + 'data': [ + 32.15625, 90.4375, -26.34375, -7.1484375, 75.875, + -48.21875, -53.09375, 66.6875, -96.1875, -88.3125, + 95, 37.28125, -42.21875, 96.5625, 0.880859375, + 62.5, 36.65625, 99.75, -72.875, -46.03125, + 20.25, -21.5625, -51.28125, -42.59375 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMax', + 'arguments': [ + {'input': 'reduceMaxInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMaxOutput' + }], + 'expectedOutputs': { + 'reduceMaxOutput': { + 'data': [90.4375, 95, 96.5625, 99.75], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } + } ]; if (navigator.ml) { diff --git a/webnn/conformance_tests/reduce_mean.https.any.js b/webnn/conformance_tests/reduce_mean.https.any.js index 01d2a548b63948..834bfb22252c8b 100644 --- a/webnn/conformance_tests/reduce_mean.https.any.js +++ b/webnn/conformance_tests/reduce_mean.https.any.js @@ -620,6 +620,521 @@ const reduceMeanTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceMean float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [95.875], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [95.875], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [95.875], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [95.875], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceMean float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + -37.15625, -44.5, -6.125, -6.3203125, -76.5625, + -4.13671875, -20.765625, -38.75, -36.8125, -26.28125, + -12.5703125, -55.28125, -20.703125, -34.1875, -45.375, + -35, -67.8125, -0.74365234375, -21.984375, -61.3125, + -58.59375, -76, -23.921875, -22.9375 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [-34.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceMean float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [48.40625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceMean float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [-47.53125], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMean float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [{'input': 'reduceMeanInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [45.46875, 49.65625, 50.9375, 44.75, 27.78125, 23.265625], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMean float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': + [{'input': 'reduceMeanInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [54.84375, 40.25, 22.0625, 48.59375, 51.34375, 24.796875], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMean float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [40.3125], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMean float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': + {'data': [40.3125], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMean float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [40.3125], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMean float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [52.28125, 45.09375, 47.625, 16.203125], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMean float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMeanInput': { + 'data': [ + 95.875, 75.6875, 1.5419921875, 8.7890625, 70.0625, + 13.78125, 20, 94.8125, 25.828125, 94.125, + 67.75, 16.09375, 92.1875, 11.5703125, 52.71875, + 22.46875, 3.662109375, 20.203125, 58.5625, 28.671875, + 42.125, 21.640625, 14.1640625, 15.125 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMean', + 'arguments': [ + {'input': 'reduceMeanInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMeanOutput' + }], + 'expectedOutputs': { + 'reduceMeanOutput': { + 'data': [52.28125, 45.09375, 47.625, 16.203125], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_min.https.any.js b/webnn/conformance_tests/reduce_min.https.any.js index b09fd5cf8a3746..c618a92b397b60 100644 --- a/webnn/conformance_tests/reduce_min.https.any.js +++ b/webnn/conformance_tests/reduce_min.https.any.js @@ -536,6 +536,444 @@ const reduceMinTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceMin float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [-58.75], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [-58.75], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-58.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [{'input': 'reduceMinInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9375, -39.5, -53.75, -31.71875, -84.4375, -55.96875], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMin float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': + [{'input': 'reduceMinInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-58.75, -87.9375, -70.125, -59.40625, -84.4375, -53.75], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMin float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9375], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceMin float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': + {'data': [-87.9375], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceMin float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9375], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMin float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9375, -53.75, -84.4375, -55.96875], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceMin float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceMinInput': { + 'data': [ + -58.75, -87.9375, -70.125, -53.625, -39.5, + 76.5, -18.703125, 44.78125, 30.703125, 61.46875, + 77.8125, -53.75, -31.71875, -9.734375, 77.9375, + 99, 73.375, 92.0625, -59.40625, -84.4375, + 75.875, 96, -55.96875, -1.791015625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceMin', + 'arguments': [ + {'input': 'reduceMinInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceMinOutput' + }], + 'expectedOutputs': { + 'reduceMinOutput': { + 'data': [-87.9375, -53.75, -84.4375, -55.96875], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_product.https.any.js b/webnn/conformance_tests/reduce_product.https.any.js index 721c9a1e499bbd..0669c666cf089b 100644 --- a/webnn/conformance_tests/reduce_product.https.any.js +++ b/webnn/conformance_tests/reduce_product.https.any.js @@ -535,6 +535,484 @@ const reduceProductTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceProduct float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [-68.75], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': + {'data': [-68.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceProduct float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [-68.75], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': + {'data': [-68.75], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceProduct float16 1D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 1D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [{'input': 'reduceProductInput'}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [ + -0.3759765625, -4.9140625, -0.332763671875, -3.849609375, + -0.53759765625, 0.0980224609375 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': + [{'input': 'reduceProductInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [ + 1.2744140625, 1.6640625, -1.1962890625, -1.95703125, + -0.0312042236328125, 0.80615234375 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceProduct float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [-0.1248779296875], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceProduct float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [1.666015625, -0.369384765625, 3.64453125, 0.0556640625], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceProduct float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceProductInput': { + 'data': [ + 1.578125, 0.8291015625, 0.81640625, -0.35205078125, + -1.390625, -1.892578125, -1.466796875, 1.2734375, + -0.8349609375, -1.912109375, 0.5244140625, -0.3974609375, + -1.90625, 1.4794921875, 1.134765625, 1.203125, + -0.9755859375, 0.68212890625, -0.6015625, -1.3427734375, + -1.41015625, 1.16015625, 0.0347900390625, -1.72265625 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceProduct', + 'arguments': [ + {'input': 'reduceProductInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceProductOutput' + }], + 'expectedOutputs': { + 'reduceProductOutput': { + 'data': [1.666015625, -0.369384765625, 3.64453125, 0.0556640625], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_sum.https.any.js b/webnn/conformance_tests/reduce_sum.https.any.js index 48b65a77b00f07..0f4fe4419de29e 100644 --- a/webnn/conformance_tests/reduce_sum.https.any.js +++ b/webnn/conformance_tests/reduce_sum.https.any.js @@ -613,6 +613,502 @@ const reduceSumTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceSum float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [69.625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [69.625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [69.625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [69.625], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + -51.78125, -34.46875, -40.96875, -83.375, -67.6875, + -18.703125, -20.28125, -20.125, -83.625, -23.65625, + -10.2109375, -36.21875, -76.25, -9.09375, -53.875, + -67.5, -71.125, -82.0625, -96.3125, -68.4375, + -26.109375, -68, -4.83203125, -48.90625 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [-1164], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1307], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 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': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [-1216], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [{'input': 'reduceSumInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [210.5, 104.5625, 226.25, 239, 260.5, 273.25], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSum float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': + [{'input': 'reduceSumInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [179.625, 260.5, 219.375, 246.875, 157.5, 250.125], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSum float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [1314], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSum float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': + {'data': [1314], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSum float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [1314], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceSum float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [355.25, 186, 362.25, 410.25], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceSum float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumInput': { + 'data': [ + 69.625, 99.1875, 32.78125, 8.8828125, 16.09375, 11.8046875, + 32.65625, 44, 77, 79.8125, 45, 24.390625, + 57.5, 57.59375, 80.25, 43.65625, 87.5, 94.5, + 35.53125, 42.84375, 88.5625, 98.875, 25.625, 60.1875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSum', + 'arguments': [ + {'input': 'reduceSumInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceSumOutput' + }], + 'expectedOutputs': { + 'reduceSumOutput': { + 'data': [355.25, 186, 362.25, 410.25], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ]; diff --git a/webnn/conformance_tests/reduce_sum_square.https.any.js b/webnn/conformance_tests/reduce_sum_square.https.any.js index 435e748f7b56a3..d2c494e9e52d13 100644 --- a/webnn/conformance_tests/reduce_sum_square.https.any.js +++ b/webnn/conformance_tests/reduce_sum_square.https.any.js @@ -640,6 +640,584 @@ const reduceSumSquareTests = [ } } } + }, + + // float16 tests + { + 'name': 'reduceSumSquare float16 0D constant tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [52.5625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': + {'data': [2762], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSumSquare float16 0D constant tensor empty axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [52.5625], + 'descriptor': {shape: [], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': + {'data': [2762], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceSumSquare float16 1D constant tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [24], dataType: 'float16'}, + 'constant': true + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 1D tensor all positive default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 1D tensor all negative default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + -1.646484375, -1.2998046875, -0.57763671875, + -0.5869140625, -1.740234375, -0.2020263671875, + -1.28125, -1.92578125, -0.63671875, + -0.5068359375, -1.9462890625, -1.5078125, + -1.212890625, -0.6669921875, -1.1337890625, + -0.450439453125, -0.7978515625, -0.2196044921875, + -0.221923828125, -0.1463623046875, -0.75537109375, + -1.0830078125, -1.3740234375, -0.059600830078125 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [28.015625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float16 1D tensor all positive integers default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 2, 4, 2, 6, 3, 9, 1, 2, 1, 4, 7, 6, + 3, 1, 3, 1, 6, 5, 1, 4, 4, 3, 8, 3 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': + {'data': [453], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': + 'reduceSumSquare float16 1D tensor all negative integers default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + -10, -6, -9, -8, -3, -4, -4, -2, -3, -2, -4, -5, + -2, -2, -3, -3, -1, -6, -1, -3, -9, -8, -5, -2 + ], + 'descriptor': {shape: [24], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': + {'data': [627], 'descriptor': {shape: [], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSumSquare float16 1D tensor with empty axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': + {'data': [2, 3], 'descriptor': {shape: [2], dataType: 'float16'}} + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': []}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': + {'data': [4, 9], 'descriptor': {shape: [2], dataType: 'float16'}} + } + } + }, + { + 'name': 'reduceSumSquare float16 2D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [4, 6], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 3D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 4D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 5D tensor default options', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [{'input': 'reduceSumSquareInput'}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 3D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': [2]}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 4.94140625, 4.30859375, 1.4765625, 3.458984375, 11.359375, + 4.97265625 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 4D tensor options.axes', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': + [{'input': 'reduceSumSquareInput'}, {'options': {'axes': [0, 2]}}], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [ + 3.72265625, 5.4453125, 5.75, 5.00390625, 8.6796875, 1.9130859375 + ], + 'descriptor': {shape: [2, 3], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 3D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 3D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 4D tensor options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [], dataType: 'float16'} + } + } + } + }, + { + 'name': 'reduceSumSquare float16 4D tensor options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [30.515625], + 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float16 4D tensor options.axes with options.keepDimensions=false', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': false}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [8.828125, 1.8974609375, 9.625, 10.1640625], + 'descriptor': {shape: [2, 2], dataType: 'float16'} + } + } + } + }, + { + 'name': + 'reduceSumSquare float16 4D tensor options.axes with options.keepDimensions=true', + 'graph': { + 'inputs': { + 'reduceSumSquareInput': { + 'data': [ + 1.3935546875, 1.20703125, 1.18359375, 0.3759765625, + 0.69677734375, 0.75244140625, 1.068359375, 1.455078125, + 0.87890625, 0.2149658203125, 0.7998046875, 0.135986328125, + 1.099609375, 0.77685546875, 1.1025390625, 0.65625, + 1.703125, 1.6025390625, 1.5185546875, 1.892578125, + 0.8408203125, 1.2294921875, 1.529296875, 0.64404296875 + ], + 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} + } + }, + 'operators': [{ + 'name': 'reduceSumSquare', + 'arguments': [ + {'input': 'reduceSumSquareInput'}, + {'options': {'axes': [1, 3], 'keepDimensions': true}} + ], + 'outputs': 'reduceSumSquareOutput' + }], + 'expectedOutputs': { + 'reduceSumSquareOutput': { + 'data': [8.828125, 1.8974609375, 9.625, 10.1640625], + 'descriptor': {shape: [2, 1, 2, 1], dataType: 'float16'} + } + } + } } ];