mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
[WebNN EP] Support ConvTranspose for TFLite backend (#21291)
### Description Chromium supports ConvTranspose for TFLite in https://chromium-review.googlesource.com/c/chromium/src/+/5635194 With constraint that only default dilations and groups are supported. --------- Co-authored-by: Dwayne Robinson <fdwr@hotmail.com>
This commit is contained in:
parent
e7aa11607f
commit
1d4b161145
3 changed files with 18 additions and 2 deletions
|
|
@ -22,7 +22,7 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim
|
|||
| Clip | ai.onnx(7-10, 11, 12, 13+) | clamp | ✓ | ✓ | WebNN CPU backend only supports 3 specific ranges: [0.0, infinity], [-1.0, 1.0], [0.0, 6.0] (Chromium issue: https://issues.chromium.org/issues/326156496) |
|
||||
| Concat | ai.onnx(7-10, 11-12, 13+) | concat | ✓ | ✓ | |
|
||||
| Conv | ai.onnx(7-10, 11+) | conv2d | ✓ | ✓ | Only supports 3-D or 4-D input and 'W' (weight) |
|
||||
| ConvTranspose | ai.onnx(7-10, 11+) | convTranspose2d | ✗ | ✓ | Only supports 3-D or 4-D input and 'W' (weight). |
|
||||
| ConvTranspose | ai.onnx(7-10, 11+) | convTranspose2d | ✓ | ✓ | Only supports 3-D or 4-D input and 'W' (weight). WebNN CPU backend only supports default dilations and group |
|
||||
| Cos | ai.onnx(7+) | cos | ✓ | ✓ | |
|
||||
| Div | ai.onnx(7-12, 13, 14+) | div | ✓ | ✓ | |
|
||||
| Elu | ai.onnx(7+) | elu | ✓ | ✓ | WebNN CPU backend only supports 'alpha' value is 1.0 |
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static const InlinedHashMap<std::string, WebnnOpInfo> op_map = {
|
|||
{"Concat", {"concat", true}},
|
||||
{"Conv", {"conv2d", true}},
|
||||
{"ConvInteger", {"conv2dInteger", false}},
|
||||
{"ConvTranspose", {"convTranspose2d", false}},
|
||||
{"ConvTranspose", {"convTranspose2d", true}},
|
||||
{"Cos", {"cos", true}},
|
||||
{"Div", {"div", true}},
|
||||
{"DequantizeLinear", {"dequantizeLinear", false}},
|
||||
|
|
|
|||
|
|
@ -427,6 +427,22 @@ bool ConvOpBuilder::HasSupportedInputsImpl(const Node& node, const WebnnDeviceTy
|
|||
return false;
|
||||
}
|
||||
|
||||
// WebNN CPU backend (TFLite) only supports default dilations and group.
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:services/webnn/tflite/graph_builder_tflite.cc;l=1040
|
||||
if (device_type == WebnnDeviceType::CPU && op_type == "ConvTranspose") {
|
||||
NodeAttrHelper helper(node);
|
||||
const auto dilations = helper.Get("dilations", std::vector<int64_t>{1, 1});
|
||||
const auto group = helper.Get("group", 1);
|
||||
if (dilations[0] != 1 || (dilations.size() > 1 && dilations[1] != 1)) {
|
||||
LOGS(logger, VERBOSE) << op_type << " for WebNN CPU backend only supports default dilation 1.";
|
||||
return false;
|
||||
}
|
||||
if (group != 1) {
|
||||
LOGS(logger, VERBOSE) << op_type << " for WebNN CPU backend only supports default group 1.";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue