commit cd803dbbeb417d9e91516c2697ed66e9b36a0570
parent bd4c24803d2a41cf92734a290879d90a987a92b0
Author: BruceDai <feng.dai@intel.com>
Date: Thu, 27 Nov 2025 15:28:40 +0000
Bug 2002584 [wpt PR 56300] - webnn: only use positive scale for dequantizeLinear and quantizeLinear, a=testonly
Automatic update from web-platform-tests
webnn: only use positive scale for dequantizeLinear and quantizeLinear
Due to the lack of widespread support for the current negative scale
across all backends, this CL removes four tests related to negative
scale and updates 16 tests to exclusively use positive scale for the
dequantizeLinear and quantizeLinear operators.
Bug: 457473747
Change-Id: I45e51d3736dad286d7416ab207c7d7629695af80
Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7181723
Auto-Submit: Dai, Feng <feng.dai@intel.com>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Dai, Feng <feng.dai@intel.com>
Reviewed-by: Hu, Ningxin <ningxin.hu@intel.com>
Cr-Commit-Position: refs/heads/main@{#1550844}
--
wpt-commits: 6f219db526a658be8392d2fdb413b89b4a637e96
wpt-pr: 56300
Diffstat:
2 files changed, 52 insertions(+), 216 deletions(-)
diff --git a/testing/web-platform/tests/webnn/conformance_tests/dequantizeLinear.https.any.js b/testing/web-platform/tests/webnn/conformance_tests/dequantizeLinear.https.any.js
@@ -148,52 +148,6 @@ const dequantizeLinearTests = [
},
{
'name':
- 'dequantizeLinear uint8 1D tensor with negative float32 1D scale',
- 'graph': {
- 'inputs': {
- 'dequantizeLinearInput': {
- 'data': [12, 24, 35, 123],
- 'descriptor': {shape: [4], dataType: 'uint8'},
- 'constant': false
- },
- 'dequantizeLinearScale': {
- 'data': [
- 9.343092918395996,
- 0.2800687253475189,
- -4.617084980010986,
- 1.1202747821807861,
- ],
- 'descriptor': {shape: [4], dataType: 'float32'},
- 'constant': true
- },
- 'dequantizeLinearZeroPoint': {
- 'data': [128, 128, 128, 128],
- 'descriptor': {shape: [4], dataType: 'uint8'},
- 'constant': true
- }
- },
- 'operators': [{
- 'name': 'dequantizeLinear',
- 'arguments': [
- {'input': 'dequantizeLinearInput'},
- {'scale': 'dequantizeLinearScale'},
- {'zeroPoint': 'dequantizeLinearZeroPoint'}
- ],
- 'outputs': 'dequantizeLinearOutput'
- }],
- 'expectedOutputs': {
- 'dequantizeLinearOutput': {
- 'data': [
- -1083.798828125, -29.127147674560547, 429.388916015625,
- -5.601373672485352
- ],
- 'descriptor': {shape: [4], dataType: 'float32'}
- }
- }
- }
- },
- {
- 'name':
'dequantizeLinear uint8 1D tensor with float32 1D scale, implicit block_size = 2',
'graph': {
'inputs': {
@@ -205,7 +159,7 @@ const dequantizeLinearTests = [
'dequantizeLinearScale': {
'data': [
9.343092918395996,
- -4.617084980010986,
+ 4.617084980010986,
],
'descriptor': {shape: [2], dataType: 'float32'},
'constant': true
@@ -228,8 +182,8 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -1083.798828125, -971.681640625, 346.2813720703125,
- -60.0221061706543
+ -1083.798828125, -971.681640625, -346.2813720703125,
+ 60.0221061706543
],
'descriptor': {shape: [4], dataType: 'float32'}
}
@@ -247,7 +201,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [0.2800687253475189, -4.617084980010986],
+ 'data': [0.2800687253475189, 4.617084980010986],
'descriptor': {shape: [1, 1, 2, 1], dataType: 'float32'},
'constant': true
},
@@ -269,8 +223,8 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -38.08934783935547, -3.3608245849609375, -50.787933349609375,
- -507.87933349609375
+ -38.08934783935547, -3.3608245849609375, 50.787933349609375,
+ 507.87933349609375
],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'float32'}
}
@@ -292,8 +246,8 @@ const dequantizeLinearTests = [
},
'dequantizeLinearScale': {
'data': [
- 0.2800687253475189, -4.617084980010986, 1.2800687253475189,
- -3.617084980010986
+ 0.2800687253475189, 4.617084980010986, 1.2800687253475189,
+ 3.617084980010986
],
'descriptor': {shape: [2, 2], dataType: 'float32'},
'constant': true
@@ -318,28 +272,28 @@ const dequantizeLinearTests = [
'data': [
-35.00859069824219,
-0.2800687253475189,
- -92.3416976928711,
- -549.43310546875,
+ 92.3416976928711,
+ 549.43310546875,
3.0807559490203857,
6.1615118980407715,
- -193.91757202148438,
- -152.36380004882812,
+ 193.91757202148438,
+ 152.36380004882812,
18.484535217285156,
21.565292358398438,
- 115.4271240234375,
- 13.851255416870117,
+ -115.4271240234375,
+ -13.851255416870117,
-49.92267990112305,
-64.0034408569336,
- 245.96177673339844,
- 285.7497253417969,
+ -245.96177673339844,
+ -285.7497253417969,
107.52577209472656,
32.0017204284668,
0,
- -39.787933349609375,
+ 39.787933349609375,
65.28350830078125,
79.36426544189453,
- -159.1517333984375,
- 86.81004333496094
+ 159.1517333984375,
+ -86.81004333496094
],
'descriptor': {shape: [6, 4], dataType: 'float32'}
}
@@ -435,7 +389,7 @@ const dequantizeLinearTests = [
'dequantizeLinearScale': {
'data': [
9.343092918395996,
- -4.617084980010986,
+ 4.617084980010986,
],
'descriptor': {shape: [1, 1, 2, 1], dataType: 'float32'},
'constant': true
@@ -458,8 +412,8 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -18.686185836791992, -9.343092918395996, -32.31959533691406,
- -55.40502166748047
+ -18.686185836791992, -9.343092918395996, 32.31959533691406,
+ 55.40502166748047
],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'float32'}
}
@@ -479,7 +433,7 @@ const dequantizeLinearTests = [
'dequantizeLinearScale': {
'data': [
9.343092918395996,
- -4.617084980010986,
+ 4.617084980010986,
],
'descriptor': {shape: [1, 1, 2], dataType: 'float32'},
'constant': true
@@ -502,8 +456,8 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -18.686185836791992, -9.343092918395996, -32.31959533691406,
- -55.40502166748047
+ -18.686185836791992, -9.343092918395996, 32.31959533691406,
+ 55.40502166748047
],
'descriptor': {shape: [1, 1, 4], dataType: 'float32'}
}
@@ -597,7 +551,7 @@ const dequantizeLinearTests = [
},
'dequantizeLinearScale': {
'data': [
- 1.1202747821807861, -4.617084980010986, 6.2405495643615723,
+ 1.1202747821807861, 4.617084980010986, 6.2405495643615723,
3.841923713684082
],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'float32'},
@@ -621,7 +575,7 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -2.2405495643615723, -9.234169960021973, -6.240549564361572,
+ -2.2405495643615723, 9.234169960021973, -6.240549564361572,
-11.525771141052246
],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'float32'}
@@ -895,44 +849,6 @@ const dequantizeLinearTests = [
},
{
'name':
- 'dequantizeLinear uint8 1D tensor with negative float16 1D scale',
- 'graph': {
- 'inputs': {
- 'dequantizeLinearInput': {
- 'data': [12, 24, 35, 123],
- 'descriptor': {'shape': [4], 'dataType': 'uint8'},
- 'constant': false
- },
- 'dequantizeLinearScale': {
- 'data': [9.34375, 0.280029296875, -4.6171875, 1.1201171875],
- 'descriptor': {'shape': [4], 'dataType': 'float16'},
- 'constant': true
- },
- 'dequantizeLinearZeroPoint': {
- 'data': [128, 128, 128, 128],
- 'descriptor': {'shape': [4], 'dataType': 'uint8'},
- 'constant': true
- }
- },
- 'operators': [{
- 'name': 'dequantizeLinear',
- 'arguments': [
- {'input': 'dequantizeLinearInput'},
- {'scale': 'dequantizeLinearScale'},
- {'zeroPoint': 'dequantizeLinearZeroPoint'}
- ],
- 'outputs': 'dequantizeLinearOutput'
- }],
- 'expectedOutputs': {
- 'dequantizeLinearOutput': {
- 'data': [-1084, -29.125, 429.5, -5.6015625],
- 'descriptor': {'shape': [4], 'dataType': 'float16'}
- }
- }
- }
- },
- {
- 'name':
'dequantizeLinear uint8 1D tensor with float16 1D scale, implicit block_size = 2',
'graph': {
'inputs': {
@@ -942,7 +858,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [9.34375, -4.6171875],
+ 'data': [9.34375, 4.6171875],
'descriptor': {'shape': [2], 'dataType': 'float16'},
'constant': true
},
@@ -963,7 +879,7 @@ const dequantizeLinearTests = [
}],
'expectedOutputs': {
'dequantizeLinearOutput': {
- 'data': [-1084, -972, 346.25, -60.03125],
+ 'data': [-1084, -972, -346.25, 60.03125],
'descriptor': {'shape': [4], 'dataType': 'float16'}
}
}
@@ -980,7 +896,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [0.280029296875, -4.6171875],
+ 'data': [0.280029296875, 4.6171875],
'descriptor': {'shape': [1, 1, 2, 1], 'dataType': 'float16'},
'constant': true
},
@@ -1001,7 +917,7 @@ const dequantizeLinearTests = [
}],
'expectedOutputs': {
'dequantizeLinearOutput': {
- 'data': [-38.09375, -3.359375, -50.78125, -508],
+ 'data': [-38.09375, -3.359375, 50.78125, 508],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'float16'}
}
}
@@ -1021,7 +937,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [0.280029296875, -4.6171875, 1.2802734375, -3.6171875],
+ 'data': [0.280029296875, 4.6171875, 1.2802734375, 3.6171875],
'descriptor': {'shape': [2, 2], 'dataType': 'float16'},
'constant': true
},
@@ -1043,11 +959,11 @@ const dequantizeLinearTests = [
'expectedOutputs': {
'dequantizeLinearOutput': {
'data': [
- -35, -0.280029296875, -92.375, -549.5, 3.080078125,
- 6.16015625, -193.875, -152.375, 18.484375, 21.5625,
- 115.4375, 13.8515625, -49.9375, -64, 246,
- 285.75, 107.5625, 32, 0, -39.78125,
- 65.3125, 79.375, -159.125, 86.8125
+ -35, -0.280029296875, 92.375, 549.5, 3.080078125,
+ 6.16015625, 193.875, 152.375, 18.484375, 21.5625,
+ -115.4375, -13.8515625, -49.9375, -64, -246,
+ -285.75, 107.5625, 32, 0, 39.78125,
+ 65.3125, 79.375, 159.125, -86.8125
],
'descriptor': {'shape': [6, 4], 'dataType': 'float16'}
}
@@ -1141,7 +1057,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [9.34375, -4.6171875],
+ 'data': [9.34375, 4.6171875],
'descriptor': {'shape': [1, 1, 2, 1], 'dataType': 'float16'},
'constant': true
},
@@ -1162,7 +1078,7 @@ const dequantizeLinearTests = [
}],
'expectedOutputs': {
'dequantizeLinearOutput': {
- 'data': [-18.6875, -9.34375, -32.3125, -55.40625],
+ 'data': [-18.6875, -9.34375, 32.3125, 55.40625],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'float16'}
}
}
@@ -1179,7 +1095,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [9.34375, -4.6171875],
+ 'data': [9.34375, 4.6171875],
'descriptor': {'shape': [1, 1, 2], 'dataType': 'float16'},
'constant': true
},
@@ -1200,7 +1116,7 @@ const dequantizeLinearTests = [
}],
'expectedOutputs': {
'dequantizeLinearOutput': {
- 'data': [-18.6875, -9.34375, -32.3125, -55.40625],
+ 'data': [-18.6875, -9.34375, 32.3125, 55.40625],
'descriptor': {'shape': [1, 1, 4], 'dataType': 'float16'}
}
}
@@ -1292,7 +1208,7 @@ const dequantizeLinearTests = [
'constant': false
},
'dequantizeLinearScale': {
- 'data': [1.1201171875, -4.6171875, 6.2421875, 3.841796875],
+ 'data': [1.1201171875, 4.6171875, 6.2421875, 3.841796875],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'float16'},
'constant': true
},
@@ -1313,7 +1229,7 @@ const dequantizeLinearTests = [
}],
'expectedOutputs': {
'dequantizeLinearOutput': {
- 'data': [-2.240234375, -9.234375, -6.2421875, -11.5234375],
+ 'data': [-2.240234375, 9.234375, -6.2421875, -11.5234375],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'float16'}
}
}
diff --git a/testing/web-platform/tests/webnn/conformance_tests/quantizeLinear.https.any.js b/testing/web-platform/tests/webnn/conformance_tests/quantizeLinear.https.any.js
@@ -141,50 +141,6 @@ const quantizeLinearTests = [
}
},
{
- 'name': 'quantizeLinear float32 1D constant tensor with negative scale',
- 'graph': {
- 'inputs': {
- 'quantizeLinearInput': {
- 'data': [
- -2.549168109893799, -4.794857501983643, 8.413617134094238,
- 6.108623504638672
- ],
- 'descriptor': {shape: [4], dataType: 'float32'},
- 'constant': true
- },
- 'quantizeLinearScale': {
- 'data': [
- 9.343092918395996,
- 0.2800687253475189,
- -4.617084980010986,
- 1.1202747821807861,
- ],
- 'descriptor': {shape: [4], dataType: 'float32'},
- 'constant': true
- },
- 'quantizeLinearZeroPoint': {
- 'data': [128, 128, 128, 128],
- 'descriptor': {shape: [4], dataType: 'uint8'},
- 'constant': true
- }
- },
- 'operators': [{
- 'name': 'quantizeLinear',
- 'arguments': [
- {'input': 'quantizeLinearInput'}, {'scale': 'quantizeLinearScale'},
- {'zeroPoint': 'quantizeLinearZeroPoint'}
- ],
- 'outputs': 'quantizeLinearOutput'
- }],
- 'expectedOutputs': {
- 'quantizeLinearOutput': {
- 'data': [128, 111, 126, 133],
- 'descriptor': {shape: [4], dataType: 'uint8'}
- }
- }
- }
- },
- {
'name':
'quantizeLinear float32 2D tensor broadcasting zeroPoint and scale',
'graph': {
@@ -278,8 +234,8 @@ const quantizeLinearTests = [
},
'quantizeLinearScale': {
'data': [
- 0.2800687253475189, -4.617084980010986, 0.2800687253475189,
- -4.617084980010986
+ 0.2800687253475189, 4.617084980010986, 0.2800687253475189,
+ 4.617084980010986
],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'float32'},
'constant': true
@@ -300,7 +256,7 @@ const quantizeLinearTests = [
}],
'expectedOutputs': {
'quantizeLinearOutput': {
- 'data': [119, 129, 158, 127],
+ 'data': [119, 127, 158, 129],
'descriptor': {shape: [1, 1, 2, 2], dataType: 'uint8'}
}
}
@@ -320,7 +276,7 @@ const quantizeLinearTests = [
'constant': false
},
'quantizeLinearScale': {
- 'data': [0.2800687253475189, -4.617084980010986],
+ 'data': [0.2800687253475189, 4.617084980010986],
'descriptor': {shape: [1, 2, 1], dataType: 'float32'},
'constant': true
},
@@ -340,7 +296,7 @@ const quantizeLinearTests = [
}],
'expectedOutputs': {
'quantizeLinearOutput': {
- 'data': [119, 111, 187, 188],
+ 'data': [119, 111, 191, 190],
'descriptor': {shape: [1, 4, 1], dataType: 'uint8'}
}
}
@@ -759,42 +715,6 @@ const quantizeLinearTests = [
}
},
{
- 'name': 'quantizeLinear float16 1D tensor with negative scale',
- 'graph': {
- 'inputs': {
- 'quantizeLinearInput': {
- 'data': [-2.548828125, -4.79296875, 8.4140625, 6.109375],
- 'descriptor': {'shape': [4], 'dataType': 'float16'},
- 'constant': false
- },
- 'quantizeLinearScale': {
- 'data': [9.34375, 0.280029296875, -4.6171875, 1.1201171875],
- 'descriptor': {'shape': [4], 'dataType': 'float16'},
- 'constant': true
- },
- 'quantizeLinearZeroPoint': {
- 'data': [128, 128, 128, 128],
- 'descriptor': {'shape': [4], 'dataType': 'uint8'},
- 'constant': true
- }
- },
- 'operators': [{
- 'name': 'quantizeLinear',
- 'arguments': [
- {'input': 'quantizeLinearInput'}, {'scale': 'quantizeLinearScale'},
- {'zeroPoint': 'quantizeLinearZeroPoint'}
- ],
- 'outputs': 'quantizeLinearOutput'
- }],
- 'expectedOutputs': {
- 'quantizeLinearOutput': {
- 'data': [128, 111, 126, 133],
- 'descriptor': {'shape': [4], 'dataType': 'uint8'}
- }
- }
- }
- },
- {
'name':
'quantizeLinear float16 2D tensor broadcasting zeroPoint and scale',
'graph': {
@@ -878,7 +798,7 @@ const quantizeLinearTests = [
'constant': false
},
'quantizeLinearScale': {
- 'data': [0.280029296875, -4.6171875, 0.280029296875, -4.6171875],
+ 'data': [0.280029296875, 4.6171875, 0.280029296875, 4.6171875],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'float16'},
'constant': true
},
@@ -898,7 +818,7 @@ const quantizeLinearTests = [
}],
'expectedOutputs': {
'quantizeLinearOutput': {
- 'data': [119, 129, 158, 127],
+ 'data': [119, 127, 158, 129],
'descriptor': {'shape': [1, 1, 2, 2], 'dataType': 'uint8'}
}
}
@@ -915,7 +835,7 @@ const quantizeLinearTests = [
'constant': false
},
'quantizeLinearScale': {
- 'data': [0.280029296875, -4.6171875],
+ 'data': [0.280029296875, 4.6171875],
'descriptor': {'shape': [1, 2, 1], 'dataType': 'float16'},
'constant': true
},
@@ -935,7 +855,7 @@ const quantizeLinearTests = [
}],
'expectedOutputs': {
'quantizeLinearOutput': {
- 'data': [119, 111, 187, 188],
+ 'data': [119, 111, 191, 190],
'descriptor': {'shape': [1, 4, 1], 'dataType': 'uint8'}
}
}