ekalda commented on code in PR #13772: URL: https://github.com/apache/tvm/pull/13772#discussion_r1073653209
########## tests/python/contrib/test_ethosu/test_legalize.py: ########## @@ -951,20 +962,30 @@ def verify(ext_func): assert op.checked_type.dtype == dtype assert op.attrs.operator_type == operator_type assert op.attrs.reversed_operands == reversed_operands - if activation_function == "RELU": + if activation_function != None: assert str(op.attrs.activation) == "CLIP" if operator_type in ["MIN", "MAX"]: - # MIN and MAX with an activation must have a requantize operation - # baked into the output. To check the extra requantize node was - # picked up by the pattern, we can make sure the quantization - # information is not default. - assert float(op.attrs.ifm_scale) != 1.0 - assert int(op.attrs.ifm_zero_point) != 0 - assert float(op.attrs.ifm2_scale) != 1.0 - assert int(op.attrs.ifm2_zero_point) != 0 - assert float(op.attrs.ofm_scale) != 1.0 - assert int(op.attrs.ofm_zero_point) != 0 + if has_separate_requantize: + # In case when requantize cannot be fused with MIN/MAX + CLIP due to hardware constraints + # there should be default quantization values since requantize is separate operation. + assert float(op.attrs.ifm_scale) == 1.0 + assert int(op.attrs.ifm_zero_point) == 0 + assert float(op.attrs.ifm2_scale) == 1.0 + assert int(op.attrs.ifm2_zero_point) == 0 + assert float(op.attrs.ofm_scale) == 1.0 + assert int(op.attrs.ofm_zero_point) == 0 + else: + # MIN and MAX with an activation must have a requantize operation + # baked into the output. To check the extra requantize node was + # picked up by the pattern, we can make sure the quantization + # information is not default. + assert float(op.attrs.ifm_scale) != 1.0 + assert int(op.attrs.ifm_zero_point) != 0 + assert float(op.attrs.ifm2_scale) != 1.0 + assert int(op.attrs.ifm2_zero_point) != 0 + assert float(op.attrs.ofm_scale) != 1.0 + assert int(op.attrs.ofm_zero_point) != 0 Review Comment: Ok cool, thanks for clarifying :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org