Skip to content

Commit

Permalink
WebNN: Remove argmin/max selectLastIndex parameter
Browse files Browse the repository at this point in the history
This CL removes the selectLastIndex parameter from argMin and argMax to
align with the spec change [1].

The changes include the definition of IDL and mojo, the implementation
of DirectML and TfLite backend and the related unit tests and WPT tests.

[1] webmachinelearning/webnn#722

Bug: 352314071, 40206287
Change-Id: Ifbb1c5b8c5eef41f87b279c2b1018d2d5d0198ea
Cq-Include-Trybots: luci.chromium.try:win11-blink-rel,mac14.arm64-blink-rel,mac14-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5700708
Reviewed-by: Phillis Tang <phillis@chromium.org>
Reviewed-by: Elly FJ <ellyjones@chromium.org>
Reviewed-by: ningxin hu <ningxin.hu@intel.com>
Commit-Queue: Bin Miao <bin.miao@intel.com>
Cr-Commit-Position: refs/heads/main@{#1328688}
  • Loading branch information
miaobin authored and sadym-chromium committed Jul 18, 2024
1 parent ab1b5b5 commit 08ec27b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 404 deletions.
209 changes: 7 additions & 202 deletions webnn/resources/test_data/arg_max.json
Original file line number Diff line number Diff line change
Expand Up @@ -471,98 +471,6 @@
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor options.selectLastIndex=true",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
"data": [
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955,
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955
],
"type": "float32"
}
},
"options": {
"selectLastIndex": true
},
"expected": {
"name": "output",
"shape": [],
"data": [
20
],
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor options.selectLastIndex=false",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
"data": [
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955,
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955
],
"type": "float32"
}
},
"options": {
"selectLastIndex": false
},
"expected": {
"name": "output",
"shape": [],
"data": [
3
],
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor options.axes=[0, 2] options.keepDimensions=false",
"inputs": {
Expand Down Expand Up @@ -663,7 +571,7 @@
}
},
{
"name": "argMax float32 4D tensor options.axes=[0, 2] options.selectLastIndex=false",
"name": "argMax float32 4D tensor options.axes=[0, 2]",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
Expand Down Expand Up @@ -697,8 +605,7 @@
}
},
"options": {
"axes": [0, 2],
"selectLastIndex": false
"axes": [0, 2]
},
"expected": {
"name": "output",
Expand All @@ -712,7 +619,7 @@
}
},
{
"name": "argMax float32 4D tensor options.axes=[0, 2] options.selectLastIndex=true",
"name": "argMax float32 4D tensor options.axes=[3, 0, 1]",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
Expand Down Expand Up @@ -746,57 +653,7 @@
}
},
"options": {
"axes": [0, 2],
"selectLastIndex": true
},
"expected": {
"name": "output",
"shape": [1, 3],
"data": [
5,
6,
6
],
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=false",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
"data": [
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955,
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955
],
"type": "float32"
}
},
"options": {
"axes": [3, 0, 1],
"selectLastIndex": false
"axes": [3, 0, 1]
},
"expected": {
"name": "output",
Expand All @@ -810,56 +667,6 @@
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor options.axes=[3, 0, 1] options.selectLastIndex=true",
"inputs": {
"input": {
"shape": [2, 1, 4, 3],
"data": [
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955,
-51.0936194154457,
-6.5397018645619625,
73.81338015899149,
88.46114630531724,
-5.294266751122791,
-79.20668057325759,
-41.70176598864654,
73.81338015899149,
88.46114630531724,
-84.939998758247,
-61.488942502520906,
-98.33874402761955
],
"type": "float32"
}
},
"options": {
"axes": [3, 0, 1],
"selectLastIndex": true
},
"expected": {
"name": "output",
"shape": [4],
"data": [
5,
3,
5,
4
],
"type": "int32"
}
},
{
"name": "argMax float32 4D tensor all options",
"inputs": {
Expand Down Expand Up @@ -896,8 +703,7 @@
},
"options": {
"axes": [3, 0],
"keepDimensions": true,
"selectLastIndex": false
"keepDimensions": true
},
"expected": {
"name": "output",
Expand Down Expand Up @@ -935,7 +741,7 @@
}
},
{
"name": "argMax float32 0D scalar options.axes=[] no effect by both keepDimensions and selectLastIndex being true",
"name": "argMax float32 0D scalar options.axes=[] no effect by keepDimensions being true",
"inputs": {
"input": {
"shape": [],
Expand All @@ -947,8 +753,7 @@
},
"options": {
"axes": [],
"keepDimensions": true,
"selectLastIndex": true
"keepDimensions": true
},
"expected": {
"name": "output",
Expand Down
Loading

0 comments on commit 08ec27b

Please sign in to comment.