Skip to content

Commit b5ab7ed

Browse files
lisa0314chromium-wpt-export-bot
authored andcommitted
webnn: Enforce input data type constraints for resample2d
As specified in webmachinelearning/webnn#646 Bug: 328567884 Change-Id: Icea0e4a586aee33d7993d6e72393412b981d26ab Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5495876 Reviewed-by: Austin Sullivan <asully@chromium.org> Reviewed-by: ningxin hu <ningxin.hu@intel.com> Commit-Queue: Lisha Guo <lisha.guo@intel.com> Cr-Commit-Position: refs/heads/main@{#1297332}
1 parent 602dae0 commit b5ab7ed

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

webnn/validation_tests/resample2d.https.any.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ const tests = [
2323
options: {scales: [0.5, 0.5]},
2424
output: {dataType: 'float32', dimensions: [1, 1, 2, 2]},
2525
},
26+
{
27+
name:
28+
'[resample2d] Test building resample2d with input\'s dataType = float16',
29+
input: {dataType: 'float16', dimensions: [1, 1, 5, 5]},
30+
options: {scales: [0.5, 0.5]},
31+
output: {dataType: 'float16', dimensions: [1, 1, 2, 2]},
32+
},
2633
{
2734
name:
2835
'[resample2d] Test building resample2d with scales=[0.5, 0.5] and explicit axes=[2, 3]',
@@ -51,6 +58,11 @@ const tests = [
5158
options: {scales: [2.0, 2.0], sizes: [3, 6]},
5259
output: {dataType: 'float32', dimensions: [1, 1, 3, 6]},
5360
},
61+
{
62+
name:
63+
'[resample2d] Throw if the dataType of input is not float32 or float16',
64+
input: {dataType: 'int32', dimensions: [2, 4]},
65+
},
5466
{
5567
name: '[resample2d] Throw if the rank of input is not 4',
5668
input: {dataType: 'float32', dimensions: [2, 4]},
@@ -75,6 +87,11 @@ const tests = [
7587
input: {dataType: 'float32', dimensions: [1, 1, 2, 4]},
7688
options: {sizes: [1, 1, 4, 6]},
7789
},
90+
{
91+
name: '[resample2d] Throw if input data type is not floating type',
92+
input: {dataType: 'int32', dimensions: [1, 1, 2, 4]},
93+
options: {sizes: [1, 1, 4, 6]},
94+
},
7895
{
7996
name:
8097
'[resample2d] Throw if any size value is out of \'unsigned long\' value range',

0 commit comments

Comments
 (0)