Skip to content

Commit

Permalink
WebNN: Support 0-D scalars
Browse files Browse the repository at this point in the history
This CL fixes the WebNN spec and implementation issue [1] and allows to
present a 0-D scalar operand by empty dimensions.

This CL also adds test cases for MLGraphBuilder, XNNPACK backend, WebNN
service and DirectML backend for 0-D scalar operand.

[1]: webmachinelearning/webnn#390

Bug: 1498803, 1273291
Change-Id: Ic30602d6a1cdbe38ca3d384ffb7d8fe053b0a5a7
Cq-Include-Trybots: luci.chromium.try:win11-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5029273
Reviewed-by: Jiewei Qian <qjw@chromium.org>
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Commit-Queue: ningxin hu <ningxin.hu@intel.com>
Reviewed-by: Weizhong Xia <weizhong@google.com>
Cr-Commit-Position: refs/heads/main@{#1225264}
  • Loading branch information
huningxin authored and chromium-wpt-export-bot committed Nov 16, 2023
1 parent a55d7d9 commit e6a48c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions webnn/resources/test_data/pow.json
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@
}
},
{
"name": "pow (square) float32 4D base tensor and broadcastable 1D integer exponent tensor",
"name": "pow (square) float32 4D base tensor and broadcastable 0D integer exponent scalar",
"inputs": {
"a": {
"shape": [2, 2, 2, 3],
Expand Down Expand Up @@ -514,7 +514,7 @@
"type": "float32"
},
"b": {
"shape": [1],
"shape": [],
"data": [2], // square
"type": "float32",
"constant": true
Expand Down Expand Up @@ -553,7 +553,7 @@
}
},
{
"name": "pow (sqrt) float32 4D positive base tensor and broadcastable 1D integer exponent tensor",
"name": "pow (sqrt) float32 4D positive base tensor and broadcastable 0D integer exponent scalar",
"inputs": {
"a": {
"shape": [2, 2, 2, 3],
Expand Down Expand Up @@ -586,7 +586,7 @@
"type": "float32"
},
"b": {
"shape": [1],
"shape": [],
"data": [0.5], // sqrt
"type": "float32",
"constant": true
Expand Down

0 comments on commit e6a48c5

Please sign in to comment.