From e3786ac6bee55c41b69c0cfb94344f3372f8c991 Mon Sep 17 00:00:00 2001 From: Tim Hall Date: Tue, 28 Jul 2020 17:40:50 +0100 Subject: MLBEDSW-2679: Tensor quant comparison is incorrect - Fixed bug with the supported operator check rejecting operators based upon an incorrect comparison of the tensor quantisations Signed-off-by: Tim Hall Change-Id: Ibd0eb50077465d2c515c6ee10394d9b43cdf730c --- ethosu/vela/supported_operators.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'ethosu/vela/supported_operators.py') diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py index e6aaca31..65588bf4 100644 --- a/ethosu/vela/supported_operators.py +++ b/ethosu/vela/supported_operators.py @@ -115,7 +115,7 @@ class SupportedOperators: {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} + {op: self.check_quantization_restrictions_binary_elem_wise for op in self.binary_elem_wise_min_max_ops} ) self.supported_operator_restrictions.update({op: self.check_activation_ops for op in self.activation_ops}) @@ -364,16 +364,20 @@ class SupportedOperators: return False return True - def check_quantization_restrictions(self, op): + def check_quantization_restrictions_binary_elem_wise(self, op): # makes sure IFM1, IFM2 and OFM quantization are equal for binary ops + assert len(op.inputs) >= 2 and len(op.outputs) == 1 + if ( - len(op.inputs) == 2 - and not op.inputs[0].quantization == op.inputs[1].quantization == op.outputs[0].quantization + op.inputs[0].quantization is None + or not op.inputs[0].quantization.is_scaling_equal(op.inputs[1].quantization) + or not op.inputs[0].quantization.is_scaling_equal(op.outputs[0].quantization) ): print( "Warning: Input/output tensors with different quantization is unsupported for the", op.type, "operator" ) return False + return True def check_activation_ops(self, op): -- cgit v1.2.1