mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-12 17:57:38 +00:00
[WebNN EP] TFLite backend only supports Elu with default alpha (#20862)
This commit is contained in:
parent
ae8df4db8f
commit
c128132dd8
2 changed files with 13 additions and 3 deletions
|
|
@ -25,7 +25,7 @@ operators and the supported opset domain/versions in **WebNN EP** by ONNX Runtim
|
|||
| ConvTranspose | ai.onnx(7-10, 11+) | convTranspose2d | ✓ | ✗ | Only supports 3-D or 4-D input and 'W' (weight). |
|
||||
| Cos | ai.onnx(7+) | cos | ✗ | ✓ | |
|
||||
| Div | ai.onnx(7-12, 13, 14+) | div | ✓ | ✓ | |
|
||||
| Elu | ai.onnx(7+) | elu | ✓ | ✓ | |
|
||||
| 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 | ✗ | ✓ | |
|
||||
| Exp | ai.onnx(7-12, 13+) | exp | ✗ | ✓ | |
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class ActivationOpBuilder : public BaseOpBuilder {
|
|||
|
||||
// Operator support related.
|
||||
bool IsOpSupportedImpl(const InitializedTensorSet& initializers, const Node& node,
|
||||
WebnnDeviceType /* device_type */, const logging::Logger& logger) const override;
|
||||
WebnnDeviceType device_type, const logging::Logger& logger) const override;
|
||||
bool HasSupportedInputsImpl(const Node& node, const WebnnDeviceType device_type,
|
||||
const logging::Logger& logger) const override;
|
||||
};
|
||||
|
|
@ -72,14 +72,24 @@ Status ActivationOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
|
|||
// Operator support related.
|
||||
bool ActivationOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& /* initializers */,
|
||||
const Node& node,
|
||||
WebnnDeviceType /* device_type */,
|
||||
WebnnDeviceType device_type,
|
||||
const logging::Logger& logger) const {
|
||||
const auto& input_defs = node.InputDefs();
|
||||
const auto& op_type = node.OpType();
|
||||
|
||||
std::vector<int64_t> input_shape;
|
||||
if (!GetShape(*input_defs[0], input_shape, logger))
|
||||
return false;
|
||||
|
||||
if (op_type == "Elu" && device_type == WebnnDeviceType::CPU) {
|
||||
NodeAttrHelper helper(node);
|
||||
float alpha = helper.Get("alpha", 1.0f);
|
||||
if (alpha != 1.0f) {
|
||||
LOGS(logger, VERBOSE) << "WebNN CPU backend only supports Elu's alpha == 1.0";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue