Skip to content

Commit

Permalink
webnn: Enforce input data type constraints for conv2d
Browse files Browse the repository at this point in the history
As specified in webmachinelearning/webnn#646

Bug: 328567884
Change-Id: I620653f574303e6f5b18d3b540b647f07e0cf64c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5492307
Reviewed-by: ningxin hu <[email protected]>
Commit-Queue: Austin Sullivan <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1293407}
  • Loading branch information
a-sully authored and chromium-wpt-export-bot committed Apr 27, 2024
1 parent 21b3e71 commit ad9d84d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions webnn/validation_tests/conv2d.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,11 @@ const tests = [
input: {dataType: 'float32', dimensions: [1, 5, 5]},
filter: {dataType: 'float32', dimensions: [1, 2, 2, 1]},
},
{
name: '[conv2d] Throw if the input data type is not floating point.',
input: {dataType: 'int32', dimensions: [1, 1, 5, 5]},
filter: {dataType: 'int32', dimensions: [1, 1, 2, 2]},
},
{
name: '[conv2d] Throw if the filter is not a 4-D tensor.',
input: {dataType: 'float32', dimensions: [1, 1, 5, 5]},
Expand Down
6 changes: 6 additions & 0 deletions webnn/validation_tests/convTranspose2d.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ const tests = [
input: {dataType: 'float32', dimensions: [1, 5, 5]},
filter: {dataType: 'float32', dimensions: [1, 1, 2, 2]},
},
{
name:
'[convTranspose2d] Throw if the input data type is not floating point.',
input: {dataType: 'int32', dimensions: [1, 1, 5, 5]},
filter: {dataType: 'int32', dimensions: [1, 1, 2, 2]},
},
{
name: '[convTranspose2d] Throw if the filter is not a 4-D tensor.',
input: {dataType: 'float32', dimensions: [1, 1, 5, 5]},
Expand Down

0 comments on commit ad9d84d

Please sign in to comment.