Skip to content

Commit

Permalink
Reland "webnn: Enforce input data type constraints for gather indices"
Browse files Browse the repository at this point in the history
This is a reland of commit ef29e11bfb1f1f4eae0935fb58f0e4129620837b

The failure of services_unittests/WebNNGraphImplBackendTest.
BuildAndComputeSingleOperatorGather has been fixed by another CL: https://chromium-review.googlesource.com/c/chromium/src/+/5544945.

This CL adds int32 dataType support check besides uint32 and int64 for
gather indices compared with original CL.

Original change's description:
> webnn: Enforce input data type constraints for gather indices
>
> As specified in webmachinelearning/webnn#646
>
> Bug: 328567884
> Change-Id: I33eba7e1def430b1cb94e3e7a4868e82c5bbd9a3
> Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5520313
> Reviewed-by: Austin Sullivan <[email protected]>
> Commit-Queue: Lisha Guo <[email protected]>
> Reviewed-by: ningxin hu <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#1298443}

Bug: 328567884
Change-Id: Ide6a0e1bc6d3ebea7dce6bf37da4318e7b6e1bd1
Cq-Include-Trybots: luci.chromium.try:mac14-blink-rel,mac14.arm64-blink-rel,gpu-fyi-try-win11-qualcomm-rel-64
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5532907
Reviewed-by: ningxin hu <[email protected]>
Commit-Queue: Lisha Guo <[email protected]>
Reviewed-by: Austin Sullivan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1304870}
  • Loading branch information
lisa0314 authored and chromium-wpt-export-bot committed May 23, 2024
1 parent feec485 commit 5145a95
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion webnn/validation_tests/gather.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ const tests = [
axis: 2,
output: {dataType: 'float32', dimensions: [1, 2, 5, 6, 4]}
},
{
name: '[gather] Test gather with indices\'s dataType = uint32',
input: {dataType: 'float32', dimensions: [1, 2, 3, 4]},
indices: {dataType: 'uint32', dimensions: [5, 6]},
axis: 2,
output: {dataType: 'float32', dimensions: [1, 2, 5, 6, 4]}
},
{
name: '[gather] Test gather with indices\'s dataType = int32',
input: {dataType: 'float32', dimensions: [1, 2, 3, 4]},
indices: {dataType: 'int32', dimensions: [5, 6]},
axis: 2,
output: {dataType: 'float32', dimensions: [1, 2, 5, 6, 4]}
},
{
name: '[gather] TypeError is expected if the input is a scalar',
input: {dataType: 'float16', dimensions: []},
Expand All @@ -32,9 +46,15 @@ const tests = [
},
{
name:
'[gather] TypeError is expected if the data type of indices is invalid',
'[gather] TypeError is expected if the data type of indices is float32 which is invalid',
input: {dataType: 'float16', dimensions: [1, 2, 3, 4]},
indices: {dataType: 'float32', dimensions: [5, 6]}
},
{
name:
'[gather] TypeError is expected if the data type of indices is uint64 which is invalid',
input: {dataType: 'float16', dimensions: [1, 2, 3, 4]},
indices: {dataType: 'uint64', dimensions: [5, 6]}
}
];

Expand Down

0 comments on commit 5145a95

Please sign in to comment.