Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reland "webnn: Enforce input data type constraints for gather indices" #46217

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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