From 01eec27088000dfb17ebfa0cad485356c2cfe895 Mon Sep 17 00:00:00 2001 From: Tlopex <68688494+tlopex@users.noreply.github.com> Date: Wed, 11 Oct 2023 18:28:05 +0800 Subject: [PATCH 1/2] add quantized square --- python/tvm/relay/frontend/tflite.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/python/tvm/relay/frontend/tflite.py b/python/tvm/relay/frontend/tflite.py index 4eaa8280c307..05b781b62300 100644 --- a/python/tvm/relay/frontend/tflite.py +++ b/python/tvm/relay/frontend/tflite.py @@ -1300,11 +1300,6 @@ def convert_square(self, op): assert len(output_tensors) == 1, "output tensors length should be 1" output_tensor = output_tensors[0] - if self.is_quantized(op): - raise tvm.error.OpNotImplemented( - "TFlite quantized SQUARE operator is not supported yet." - ) - exp_type = self.get_tensor_type_str(output_tensor.tensor.Type()) out = _op.power(in_expr, relay.const(2, exp_type)) From 20f04f6013f8c86299da49c508e19580be715f78 Mon Sep 17 00:00:00 2001 From: Tlopex <68688494+tlopex@users.noreply.github.com> Date: Thu, 12 Oct 2023 00:27:35 +0800 Subject: [PATCH 2/2] add tests to quantized square --- tests/python/frontend/tflite/test_forward.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python/frontend/tflite/test_forward.py b/tests/python/frontend/tflite/test_forward.py index f1e2e28f086b..bade0c66e9cf 100644 --- a/tests/python/frontend/tflite/test_forward.py +++ b/tests/python/frontend/tflite/test_forward.py @@ -2414,7 +2414,7 @@ def test_all_unary_elemwise(): _test_forward_unary_elemwise(_test_floor) _test_forward_unary_elemwise(_test_exp) _test_forward_unary_elemwise(_test_log, negative=False) - _test_forward_unary_elemwise(_test_square) + _test_forward_unary_elemwise(_test_square, int_quant_dtype=tf.int8) _test_forward_unary_elemwise(_test_sin) _test_forward_unary_elemwise(_test_neg) _test_forward_unary_elemwise(_test_sqrt, negative=False)