aboutsummaryrefslogtreecommitdiff
path: root/ethosu/vela/supported_operators.py
diff options
context:
space:
mode:
Diffstat (limited to 'ethosu/vela/supported_operators.py')
-rw-r--r--ethosu/vela/supported_operators.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py
index 3bf46a9d..e8e8d852 100644
--- a/ethosu/vela/supported_operators.py
+++ b/ethosu/vela/supported_operators.py
@@ -100,6 +100,9 @@ class SupportedOperators:
self.supported_operator_restrictions.update(
{op: self.check_memory_only_restrictions for op in self.memory_only_ops}
)
+ self.supported_operator_restrictions.update(
+ {op: self.check_quantization_restrictions for op in self.binary_elem_wise_min_max_ops}
+ )
def is_operator_supported(self, op):
if op.type not in self.supported_operators:
@@ -301,3 +304,12 @@ class SupportedOperators:
if op.attrs["new_axis_mask"] != 0 and op.attrs["shrink_axis_mask"] != 0:
return False
return True
+
+ def check_quantization_restrictions(self, op):
+ # makes sure IFM1, IFM2 and OFM quantization are equal for binary ops
+ if (len(op.inputs) == 2
+ and not op.inputs[0].quantization == op.inputs[1].quantization == op.outputs[0].quantization):
+ print("Warning: Input/output tensors with different quantization is unsupported for the", op.type,
+ "operator")
+ return False
+ return True \ No newline at end of file