Skip to content

Commit

Permalink
[WebNN EP] Support 4 more ops for TFLite backend (microsoft#21134)
Browse files Browse the repository at this point in the history
Recently WebNN TFLite backend supports gelu, expand, softsign,
reciprocal.
  • Loading branch information
Honry committed Jun 24, 2024
1 parent ebd0368 commit 3a917e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions js/web/docs/webnn-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim
| Equal | ai.onnx(7-10, 11-12, 13-18, 19+) | equal ||| |
| Erf | ai.onnx(7-9, 10-12, 13+) | erf ||| |
| Exp | ai.onnx(7-12, 13+) | exp ||| |
| Expand | ai.onnx(8-12, 13+) | expand | || 'shape' input should be a constant |
| Expand | ai.onnx(8-12, 13+) | expand | || 'shape' input should be a constant |
| Flatten | ai.onnx(7-8, 9-10, 11-12, 13-20, 21+) | reshape ||| |
| Floor | ai.onnx(7-12, 13+) | floor ||| |
| Gather | ai.onnx(7-10, 11-12, 13+) | gather ||| |
| Gelu | ai.onnx(20+) | gelu | || |
| Gelu | ai.onnx(20+) | gelu | || |
| Gemm | ai.onnx(7-8, 9-10, 11-12, 13+) | gemm ||| Only supports 1-D 'C' input |
| GlobalAveragePool | ai.onnx(7+) | averagePool2d ||| Only supports 4-D input |
| GlobalMaxPool | ai.onnx(7+) | maxPool2d ||| Only supports 4-D input |
Expand All @@ -60,7 +60,7 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim
| Pad | ai.onnx(7-10, 11-12, 13-17, 18, 19-20, 21+) | pad ||| modes == 'wrap' is not supported |
| Pow | ai.onnx(7-11, 12, 13-14, 15+) | pow ||| |
| PRelu | ai.onnx(7-8, 9-15, 16+) | prelu ||| WebNN CPU backend restricts the last dimension of input and slope to be same (Chromium issue: https://issues.chromium.org/issues/335517470) |
| Reciprocal | ai.onnx(7-12, 13+) | reciprocal | || |
| Reciprocal | ai.onnx(7-12, 13+) | reciprocal | || |
| ReduceL1 | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceL1 ||| Input 'axes' if present should be a constant |
| ReduceL2 | ai.onnx(7-10, 11-12, 13-17, 18+) | reduceL2 ||| Input 'axes' if present should be a constant |
| ReduceLogSum| ai.onnx(7-10, 11-12, 13-17, 18+) | reduceLogSum||| Input 'axes' if present should be a constant |
Expand All @@ -77,7 +77,7 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim
| Shape | ai.onnx(7-12, 13-14, 15-18, 19-20, 21+) | slice ||| |
| Sigmoid | ai.onnx(7-12, 13+) | sigmoid ||| |
| Softplus | ai.onnx(7+) | softplus ||| |
| Softsign | ai.onnx(7+) | softsign | || |
| Softsign | ai.onnx(7+) | softsign | || |
| Sin | ai.onnx(7+) | sin ||| |
| Slice | ai.onnx(7-9, 10, 11-12, 13+) | slice ||| Input 'starts', 'ends', 'axes', and 'steps' if present must be a constant, only supports 'steps' value 1 |
| Softmax | ai.onnx(7-10, 11-12, 13+) | softmax ||| |
Expand Down
8 changes: 4 additions & 4 deletions onnxruntime/core/providers/webnn/builders/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ static const InlinedHashMap<std::string, WebnnOpInfo> op_map = {
{"Equal", {"equal", true}},
{"Erf", {"erf", false}},
{"Exp", {"exp", true}},
{"Expand", {"expand", false}},
{"Expand", {"expand", true}},
{"Flatten", {"reshape", true}},
{"Floor", {"floor", true}},
{"Gather", {"gather", true}},
{"Gelu", {"gelu", false}},
{"Gelu", {"gelu", true}},
{"Gemm", {"gemm", true}},
{"GlobalAveragePool", {"averagePool2d", true}},
{"GlobalMaxPool", {"maxPool2d", true}},
Expand Down Expand Up @@ -208,7 +208,7 @@ static const InlinedHashMap<std::string, WebnnOpInfo> op_map = {
{"Pad", {"pad", true}},
{"Pow", {"pow", true}},
{"PRelu", {"prelu", true}},
{"Reciprocal", {"reciprocal", false}},
{"Reciprocal", {"reciprocal", true}},
{"ReduceL1", {"reduceL1", false}},
{"ReduceL2", {"reduceL2", false}},
{"ReduceLogSum", {"reduceLogSum", false}},
Expand All @@ -225,7 +225,7 @@ static const InlinedHashMap<std::string, WebnnOpInfo> op_map = {
{"Shape", {"slice", true}},
{"Sigmoid", {"sigmoid", true}},
{"Softplus", {"softplus", true}},
{"Softsign", {"softsign", false}},
{"Softsign", {"softsign", true}},
{"Sin", {"sin", true}},
{"Slice", {"slice", true}},
{"Softmax", {"softmax", true}},
Expand Down

0 comments on commit 3a917e4

Please sign in to comment.