mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-07 00:13:17 +00:00
[WebNN EP] Only support opset >= 7 (#16730)
Set WebNN EP minimum supported opset to 7 as ONNX Runtime currently only guarantees support for models stamped with opset 7 or above.
This commit is contained in:
parent
7dcb805ab8
commit
dcb0f2cdde
5 changed files with 3 additions and 33 deletions
|
|
@ -17,10 +17,6 @@ class ActivationOpBuilder : public BaseOpBuilder {
|
|||
private:
|
||||
Status AddToModelBuilderImpl(ModelBuilder& model_builder, const Node& node,
|
||||
const logging::Logger& logger) const override ORT_MUST_USE_RESULT;
|
||||
|
||||
// Operator support related.
|
||||
private:
|
||||
int GetMinSupportedOpSet(const Node& node) const override;
|
||||
};
|
||||
|
||||
// Add operator related.
|
||||
|
|
@ -70,13 +66,6 @@ Status ActivationOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
// Operator support related.
|
||||
|
||||
int ActivationOpBuilder::GetMinSupportedOpSet(const Node& /* node */) const {
|
||||
// Any operators < opset 6 used the deprecated "consumed_inputs attribute" which is unsupported.
|
||||
return 6;
|
||||
}
|
||||
|
||||
void CreateActivationOpBuilder(const std::string& op_type, OpBuilderRegistrations& op_registrations) {
|
||||
if (op_registrations.op_builder_map.find(op_type) != op_registrations.op_builder_map.cend())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,9 @@ class BaseOpBuilder : public IOpBuilder {
|
|||
virtual bool HasSupportedInputsImpl(const Node& node, const WebnnDeviceType device_type,
|
||||
const logging::Logger& logger) const;
|
||||
|
||||
virtual int GetMinSupportedOpSet(const Node& /* node */) const { return 1; }
|
||||
// ONNX Runtime only *guarantees* support for models stamped
|
||||
// with opset version 7 or above for opset domain 'ai.onnx'.
|
||||
virtual int GetMinSupportedOpSet(const Node& /* node */) const { return 7; }
|
||||
virtual int GetMaxSupportedOpSet(const Node& /* node */) const { return 19; }
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@ class BinaryOpBuilder : public BaseOpBuilder {
|
|||
private:
|
||||
Status AddToModelBuilderImpl(ModelBuilder& model_builder, const Node& node,
|
||||
const logging::Logger& logger) const override ORT_MUST_USE_RESULT;
|
||||
|
||||
// Operator support related.
|
||||
private:
|
||||
int GetMinSupportedOpSet(const Node& node) const override;
|
||||
};
|
||||
|
||||
// Add operator related.
|
||||
|
|
@ -52,13 +48,6 @@ Status BinaryOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder, const
|
|||
return Status::OK();
|
||||
}
|
||||
|
||||
// Operator support related.
|
||||
|
||||
int BinaryOpBuilder::GetMinSupportedOpSet(const Node& /* node */) const {
|
||||
// Add/Sub/Mul/Div/Pow opset 6- has broadcast attributes we do not support now.
|
||||
return 7;
|
||||
}
|
||||
|
||||
void CreateBinaryOpBuilder(const std::string& op_type, OpBuilderRegistrations& op_registrations) {
|
||||
if (op_registrations.op_builder_map.find(op_type) != op_registrations.op_builder_map.cend())
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ class CastOpBuilder : public BaseOpBuilder {
|
|||
private:
|
||||
bool IsOpSupportedImpl(const InitializedTensorSet& /* initializers */, const Node& node,
|
||||
const WebnnDeviceType device_type, const logging::Logger& logger) const override;
|
||||
|
||||
int GetMinSupportedOpSet(const Node& node) const override;
|
||||
};
|
||||
|
||||
// Add operator related.
|
||||
|
|
@ -76,11 +74,6 @@ Status CastOpBuilder::AddToModelBuilderImpl(ModelBuilder& model_builder,
|
|||
|
||||
// Operator support related.
|
||||
|
||||
int CastOpBuilder::GetMinSupportedOpSet(const Node& /* node */) const {
|
||||
// Since opset 6, Cast uses attribute "to" as int type.
|
||||
return 6;
|
||||
}
|
||||
|
||||
bool CastOpBuilder::IsOpSupportedImpl(const InitializedTensorSet& /* initializers */,
|
||||
const Node& node,
|
||||
const WebnnDeviceType device_type,
|
||||
|
|
|
|||
|
|
@ -30,9 +30,6 @@ class ReshapeOpBuilder : public BaseOpBuilder {
|
|||
private:
|
||||
bool IsOpSupportedImpl(const InitializedTensorSet& initializers, const Node& node,
|
||||
const WebnnDeviceType /* device_type */, const logging::Logger& logger) const override;
|
||||
|
||||
// Reshape opset 4- uses attributes for new shape which we do not support for now.
|
||||
int GetMinSupportedOpSet(const Node& /* node */) const override { return 5; }
|
||||
};
|
||||
|
||||
// Add operator related.
|
||||
|
|
|
|||
Loading…
Reference in a new issue