Bug 1893848 [wpt PR 45945] - webnn: Enforce input data type constraints for gemm and matmul, a=testonly

Automatic update from web-platform-tests
webnn: Enforce input data type constraints for gemm and matmul

As specified in https://github.com/webmachinelearning/webnn/pull/646

Bug: 328567884
Change-Id: Ia55a214e7ad281ec3c8911e9116f388fac209d05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5495161
Auto-Submit: Shiyi Zou <shiyi.zou@intel.com>
Commit-Queue: Shiyi Zou <shiyi.zou@intel.com>
Reviewed-by: Austin Sullivan <asully@chromium.org>
Reviewed-by: ningxin hu <ningxin.hu@intel.com>
Cr-Commit-Position: refs/heads/main@{#1294123}

--

wpt-commits: 0664d8153b085b9b3a94ecc52bc5b04d37e7d6fa
wpt-pr: 45945
This commit is contained in:
Shiyi Zou 2024-04-30 16:06:59 +00:00 коммит произвёл moz-wptsync-bot
Родитель a2ca0f7237
Коммит f882341b09
2 изменённых файлов: 27 добавлений и 15 удалений

Просмотреть файл

@ -34,7 +34,7 @@ const tests = [
b: {dataType: 'float32', dimensions: [2, 4]},
},
{
name: 'Test building gemm with aTranspose=true.',
name: '[gemm] Test building gemm with aTranspose=true.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [2, 4]},
options: {
@ -44,7 +44,7 @@ const tests = [
},
{
name:
'Throw if inputShapeA[0] is not equal to inputShapeB[0] with aTranspose=true.',
'[gemm] Throw if inputShapeA[0] is not equal to inputShapeB[0] with aTranspose=true.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [3, 4]},
options: {
@ -52,7 +52,7 @@ const tests = [
},
},
{
name: 'Test building gemm with bTranspose=true.',
name: '[gemm] Test building gemm with bTranspose=true.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [4, 3]},
options: {
@ -62,7 +62,7 @@ const tests = [
},
{
name:
'Throw if inputShapeA[0] is not equal to inputShapeB[0] with bTranspose=true.',
'[gemm] Throw if inputShapeA[0] is not equal to inputShapeB[0] with bTranspose=true.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [3, 4]},
options: {
@ -70,22 +70,22 @@ const tests = [
},
},
{
name: 'Throw if the rank of inputA is not 2.',
name: '[gemm] Throw if the rank of inputA is not 2.',
a: {dataType: 'float32', dimensions: [2, 3, 1]},
b: {dataType: 'float32', dimensions: [2, 4]},
},
{
name: 'Throw if the rank of inputB is not 2.',
name: '[gemm] Throw if the rank of inputB is not 2.',
a: {dataType: 'float32', dimensions: [2, 4]},
b: {dataType: 'float32', dimensions: [2, 3, 1]},
},
{
name: 'Throw if data types of two inputs do not match.',
name: '[gemm] Throw if data types of two inputs do not match.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'int32', dimensions: [3, 4]},
b: {dataType: 'float16', dimensions: [3, 4]},
},
{
name: 'Test building gemm with inputC.',
name: '[gemm] Test building gemm with inputC.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [3, 4]},
options: {
@ -94,7 +94,7 @@ const tests = [
output: {dataType: 'float32', dimensions: [2, 4]}
},
{
name: 'Test building gemm with scalar inputC.',
name: '[gemm] Test building gemm with scalar inputC.',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [3, 4]},
options: {
@ -104,26 +104,31 @@ const tests = [
},
{
name:
'Throw if inputShapeC is not unidirectionally broadcastable to the output shape [inputShapeA[0], inputShapeB[1]].',
'[gemm] Throw if inputShapeC is not unidirectionally broadcastable to the output shape [inputShapeA[0], inputShapeB[1]].',
a: {dataType: 'float32', dimensions: [2, 3]},
b: {dataType: 'float32', dimensions: [3, 4]},
options: {
c: {dataType: 'float32', dimensions: [2, 3]},
},
},
{
name: '[gemm] Throw if the input data type is not floating point.',
a: {dataType: 'int32', dimensions: [2, 3]},
b: {dataType: 'int32', dimensions: [3, 4]}
},
{
name:
'Throw if data type of inputC does not match ones of inputA and inputB.',
'[gemm] Throw if data type of inputC does not match ones of inputA and inputB.',
a: {dataType: 'float32', dimensions: [3, 2]},
b: {dataType: 'float32', dimensions: [4, 3]},
options: {
c: {dataType: 'int32', dimensions: [2, 4]},
c: {dataType: 'float16', dimensions: [2, 4]},
aTranspose: true,
bTranspose: true,
},
},
{
name: 'Throw if the rank of inputC is 3.',
name: '[gemm] Throw if the rank of inputC is 3.',
a: {dataType: 'float32', dimensions: [3, 2]},
b: {dataType: 'float32', dimensions: [4, 3]},
options: {

Просмотреть файл

@ -67,11 +67,18 @@ const tests = [
},
output: {dataType: 'float32', dimensions: [2, 3, 5]}
},
{
name: '[matmul] Throw if the input data type is not floating point',
inputs: {
a: {dataType: 'uint32', dimensions: [2, 3, 4]},
b: {dataType: 'uint32', dimensions: [2, 4, 5]}
}
},
{
name: '[matmul] Throw if data type of two inputs don\'t match',
inputs: {
a: {dataType: 'float32', dimensions: [2, 3, 4]},
b: {dataType: 'int32', dimensions: [2, 4, 5]}
b: {dataType: 'float16', dimensions: [2, 4, 5]}
}
},
{