Skip to content

Commit 23aaf63

Browse files
lisa0314sadym-chromium
authored andcommitted
WebNN: Add missing 64-bit integers support for some reduce operators
This CL adds 64-bit integer support for reduceL1, reduceProduct, reduceSum and reduceSumSquare. It's based on the spec change being proposed by webmachinelearning/webnn#695. Bug: 328567884 Change-Id: Ia858b47082f81a9eb6ab3b9403e3773a752eb608 Cq-Include-Trybots: luci.chromium.try:win11-blink-rel,mac14-blink-rel,mac14.arm64-blink-rel Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5569544 Reviewed-by: ningxin hu <[email protected]> Reviewed-by: Austin Sullivan <[email protected]> Commit-Queue: Lisha Guo <[email protected]> Cr-Commit-Position: refs/heads/main@{#1309157}
1 parent 46dc92e commit 23aaf63

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

webnn/validation_tests/reduction.https.any.js

+19-7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const kFloatRestrictReductionOperators = [
2424
'reduceMean',
2525
];
2626

27-
const kFloatInt32Uint32RestrictReductionOperators = [
27+
const kFloatInt32Uint32Int64Uint64RestrictReductionOperators = [
2828
'reduceL1',
2929
'reduceProduct',
3030
'reduceSum',
@@ -87,7 +87,7 @@ const kFloatRestrictOperatorsTests = [
8787
},
8888
];
8989

90-
const kFloatInt32Uint32RestrictOperatorsTests = [
90+
const kFloatInt32Uint32Int64Uint64RestrictOperatorsTests = [
9191
{
9292
name: '[reduce] Test reduce when input\'s datatype is int32.',
9393
input: {dataType: 'int32', dimensions: [1, 2, 5, 5]},
@@ -99,9 +99,19 @@ const kFloatInt32Uint32RestrictOperatorsTests = [
9999
output: {dataType: 'uint32', dimensions: []}
100100
},
101101
{
102-
name:
103-
'[reduce] Throw if the input data type is not one of the {float32, float16, int32, uint32}.',
102+
name: '[reduce] Test reduce when input\'s datatype is int64.',
104103
input: {dataType: 'int64', dimensions: [1, 2, 5, 5]},
104+
output: {dataType: 'int64', dimensions: []}
105+
},
106+
{
107+
name: '[reduce] Test reduce when input\'s datatype is uint64.',
108+
input: {dataType: 'uint64', dimensions: [1, 2, 5, 5]},
109+
output: {dataType: 'uint64', dimensions: []}
110+
},
111+
{
112+
name:
113+
'[reduce] Throw if the input data type is not one of the {float32, float16, int32, uint32, int64, uint64}.',
114+
input: {dataType: 'int8', dimensions: [1, 2, 5, 5]},
105115
options: {
106116
axes: [0, 1],
107117
},
@@ -159,9 +169,11 @@ kFloatRestrictReductionOperators.forEach((operatorName) => {
159169
runReductionTests(operatorName, kFloatRestrictOperatorsTests);
160170
});
161171

162-
kFloatInt32Uint32RestrictReductionOperators.forEach((operatorName) => {
163-
runReductionTests(operatorName, kFloatInt32Uint32RestrictOperatorsTests);
164-
});
172+
kFloatInt32Uint32Int64Uint64RestrictReductionOperators.forEach(
173+
(operatorName) => {
174+
runReductionTests(
175+
operatorName, kFloatInt32Uint32Int64Uint64RestrictOperatorsTests);
176+
});
165177

166178
kNoTypeRestrictReductionOperators.forEach((operatorName) => {
167179
runReductionTests(operatorName, kNoTypeRestrictOperatorsTests);

0 commit comments

Comments
 (0)