From 54e99d2545c58e1f91da61570e1db51b0a9b6569 Mon Sep 17 00:00:00 2001 From: lisa0314 Date: Tue, 14 May 2024 22:15:08 +0000 Subject: [PATCH] Bug 1895442 [wpt PR 46129] - webnn: Enforce input data type constraints for gather indices, a=testonly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automatic update from web-platform-tests webnn: Enforce input data type constraints for gather indices As specified in https://github.com/webmachinelearning/webnn/pull/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 Commit-Queue: Lisha Guo Reviewed-by: ningxin hu Cr-Commit-Position: refs/heads/main@{#1298443} -- wpt-commits: d32b68ce2a00a378db571901573b2ded4d8ab349 wpt-pr: 46129 --- .../webnn/validation_tests/gather.https.any.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/testing/web-platform/tests/webnn/validation_tests/gather.https.any.js b/testing/web-platform/tests/webnn/validation_tests/gather.https.any.js index 184e8033e6624..95bd074adc01a 100644 --- a/testing/web-platform/tests/webnn/validation_tests/gather.https.any.js +++ b/testing/web-platform/tests/webnn/validation_tests/gather.https.any.js @@ -8,7 +8,7 @@ const tests = [ { name: '[gather] Test gather with default options and 0-D indices', input: {dataType: 'int32', dimensions: [3]}, - indices: {dataType: 'uint64', dimensions: []}, + indices: {dataType: 'int64', dimensions: []}, output: {dataType: 'int32', dimensions: []} }, { @@ -24,15 +24,23 @@ const tests = [ indices: {dataType: 'int64', dimensions: [1]} }, { - name: '[gather] TypeError is expected if the axis is greater than the rank of input', + name: + '[gather] TypeError is expected if the axis is greater than the rank of input', input: {dataType: 'float16', dimensions: [1, 2, 3]}, - indices: {dataType: 'int32', dimensions: [5, 6]}, + indices: {dataType: 'uint32', dimensions: [5, 6]}, axis: 4 }, { - name: '[gather] TypeError is expected if the data type of indices is invalid', + name: + '[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 int32 which is invalid', + input: {dataType: 'float16', dimensions: [1, 2, 3, 4]}, + indices: {dataType: 'int32', dimensions: [5, 6]} } ];