Bug 1871973 [wpt PR 43795] - Update reshape tests, a=testonly

Automatic update from web-platform-tests
Update reshape tests (#43795)

* [webnn] Pre-casting input data to be of float32 type for reshape op

* [webnn] Use reshape op to replace squeeze op

* [webnn] Add more float32 tests for reshape (unsqueeze) op

* [webnn] Add more float32 tests for reshape (flatten) op
--

wpt-commits: 4388aa9fa71dc6e9410880f63a271b6095fb84a0
wpt-pr: 43795
This commit is contained in:
BruceDai 2024-01-16 17:02:35 +00:00 коммит произвёл moz-wptsync-bot
Родитель 38ba5b77f2
Коммит 1fda609e6f
5 изменённых файлов: 1837 добавлений и 837 удалений

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

@ -1,10 +0,0 @@
// META: title=test WebNN API squeeze operation
// META: global=window,dedicatedworker
// META: script=../resources/utils.js
// META: timeout=long
'use strict';
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-squeeze
testWebNNOperation('squeeze', buildOperationWithSingleInput, 'gpu');

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -1,696 +0,0 @@
{
"tests": [
{
"name": "squeeze float32 2D tensor by eliminating one dimension default options",
"inputs": {
"input": {
"shape": [1, 24],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 3D tensor by eliminating one dimension default options",
"inputs": {
"input": {
"shape": [4, 1, 6],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [4, 6],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 3D tensor by eliminating two dimensions default options",
"inputs": {
"input": {
"shape": [1, 24, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 4D tensor by eliminating two dimensions default options",
"inputs": {
"input": {
"shape": [1, 4, 1, 6],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [4, 6],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 4D tensor by eliminating all dimensions default options",
"inputs": {
"input": {
"shape": [1, 1, 1, 1],
"data": [
19.404981030500302
],
"type": "float32"
}
},
"expected": {
"name": "output",
"data": 19.40498161315918,
"type": "float32"
}
},
{
"name": "squeeze float32 5D tensor by eliminating four dimensions default options",
"inputs": {
"input": {
"shape": [1, 1, 1, 24, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 2D tensor by eliminating one dimension options.axes",
"inputs": {
"input": {
"shape": [1, 24],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"options": {
"axes": [0]
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 3D tensor by eliminating two dimensions options.axes",
"inputs": {
"input": {
"shape": [24, 1, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"options": {
"axes": [1, 2]
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 4D tensor by eliminating two dimensions options.axes",
"inputs": {
"input": {
"shape": [1, 4, 6, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"options": {
"axes": [0, 3]
},
"expected": {
"name": "output",
"shape": [4, 6],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 5D tensor by eliminating two dimensions options.axes",
"inputs": {
"input": {
"shape": [2, 1, 1, 12, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"options": {
"axes": [1, 2]
},
"expected": {
"name": "output",
"shape": [2, 12, 1],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
},
{
"name": "squeeze float32 5D tensor by eliminating four dimensions options.axes",
"inputs": {
"input": {
"shape": [1, 1, 1, 24, 1],
"data": [
1.1293665986622017,
-93.29325783541842,
-19.999887095191227,
41.119214363429876,
92.69352298075461,
-41.51937878962313,
-56.75228730395734,
11.148093991767155,
5.57540042674151,
15.709176425437747,
62.550443705517665,
-5.299276370816216,
-18.61525168224469,
-66.94721623021692,
94.97520289870027,
-21.94004801967297,
30.047636856615554,
13.805134987122344,
-45.08670702769,
76.90356276507339,
46.96974979938284,
-86.58127045567055,
31.645846897982068,
-67.96637618240129
],
"type": "float32"
}
},
"options": {
"axes": [0, 1, 2, 4]
},
"expected": {
"name": "output",
"shape": [24],
"data": [
1.1293666362762451,
-93.29325866699219,
-19.999887466430664,
41.11921310424805,
92.69351959228516,
-41.519378662109375,
-56.752288818359375,
11.148094177246094,
5.575400352478027,
15.709176063537598,
62.550445556640625,
-5.299276351928711,
-18.615251541137695,
-66.94721984863281,
94.97520446777344,
-21.940048217773438,
30.047636032104492,
13.805134773254395,
-45.086708068847656,
76.903564453125,
46.969749450683594,
-86.58126831054688,
31.64584732055664,
-67.96637725830078
],
"type": "float32"
}
}
]
}

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

@ -361,7 +361,6 @@ const PrecisionMetrics = {
softplus: {ULP: {float32: 18, float16: 18}},
softsign: {ULP: {float32: 3, float16: 3}},
split: {ULP: {float32: 0, float16: 0}},
squeeze: {ULP: {float32: 0, float16: 0}},
tanh: {ATOL: {float32: 1/1024, float16: 1/512}},
transpose: {ULP: {float32: 0, float16: 0}},
where: {ULP: {float32: 0, float16: 0}},

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

@ -1,10 +0,0 @@
// META: title=test WebNN API squeeze operation
// META: global=window,dedicatedworker
// META: script=./resources/utils.js
// META: timeout=long
'use strict';
// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-squeeze
testWebNNOperation('squeeze', buildOperationWithSingleInput);