From 7ae0b4ce64eefe7dae441173faae9a6a0fdb1cdd Mon Sep 17 00:00:00 2001 From: Wanming Lin Date: Mon, 19 Aug 2024 22:56:16 +0800 Subject: [PATCH] [WebNN EP] Support Erf and Trilu for CPU backend (#21768) --- js/web/docs/webnn-operators.md | 4 ++-- onnxruntime/core/providers/webnn/builders/helper.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/web/docs/webnn-operators.md b/js/web/docs/webnn-operators.md index 9934c75862..48b06b780d 100644 --- a/js/web/docs/webnn-operators.md +++ b/js/web/docs/webnn-operators.md @@ -28,7 +28,7 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim | Dropout | ai.onnx(7-9, 10-11, 12, 13-21, 22+) | identity | ✓ | ✓ | Only supports test mode | | Elu | ai.onnx(7+) | elu | ✓ | ✓ | WebNN CPU backend only supports 'alpha' value is 1.0 | | Equal | ai.onnx(7-10, 11-12, 13-18, 19+) | equal | ✓ | ✓ | | -| Erf | ai.onnx(7-9, 10-12, 13+) | erf | ✗ | ✓ | | +| 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 | | Flatten | ai.onnx(7-8, 9-10, 11-12, 13-20, 21+) | reshape | ✓ | ✓ | | @@ -89,6 +89,6 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim | Tan | ai.onnx(7+) | tan | ✓ | ✓ | | | Tanh | ai.onnx(7-12, 13+) | tanh | ✓ | ✓ | | | Transpose | ai.onnx(7-12, 13-20, 21+) | transpose | ✓ | ✓ | | -| Trilu | ai.onnx(14+) | triangular | ✗ | ✓ | Input 'k' (option 'diagonal' for WebNN) if present should be a constant | +| Trilu | ai.onnx(14+) | triangular | ✓ | ✓ | Input 'k' (option 'diagonal' for WebNN) if present should be a constant | | Unsqueeze | ai.onnx(7-10, 11-12, 13-20, 21+) | reshape | ✓ | ✓ | | | Where | ai.onnx(7-8, 9-15, 16+) | where | ✓ | ✓ | | diff --git a/onnxruntime/core/providers/webnn/builders/helper.h b/onnxruntime/core/providers/webnn/builders/helper.h index fc13ce201f..b4ef830e99 100644 --- a/onnxruntime/core/providers/webnn/builders/helper.h +++ b/onnxruntime/core/providers/webnn/builders/helper.h @@ -175,7 +175,7 @@ static const InlinedHashMap op_map = { {"DynamicQuantizeLinear", {"dynamicQuantizeLinear", false}}, {"Elu", {"elu", true}}, {"Equal", {"equal", true}}, - {"Erf", {"erf", false}}, + {"Erf", {"erf", true}}, {"Exp", {"exp", true}}, {"Expand", {"expand", true}}, {"Flatten", {"reshape", true}}, @@ -237,7 +237,7 @@ static const InlinedHashMap op_map = { {"Tan", {"tan", true}}, {"Tanh", {"tanh", true}}, {"Transpose", {"transpose", true}}, - {"Trilu", {"triangular", false}}, + {"Trilu", {"triangular", true}}, {"Unsqueeze", {"reshape", true}}, {"Where", {"where", true}}, };