This is an automated email from the ASF dual-hosted git repository.
leandron pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 99336c34b9 [TFLite][Frontend] Support quantized SQUARE (#15914)
99336c34b9 is described below
commit 99336c34b949a5ab57ef44d6f3299b3adaa96b50
Author: Tlopex <[email protected]>
AuthorDate: Thu Nov 9 21:40:51 2023 +0800
[TFLite][Frontend] Support quantized SQUARE (#15914)
* add quantized square
* add tests to quantized square
---
python/tvm/relay/frontend/tflite.py | 5 -----
tests/python/frontend/tflite/test_forward.py | 2 +-
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/python/tvm/relay/frontend/tflite.py
b/python/tvm/relay/frontend/tflite.py
index cbf08da6a1..1880887b7e 100644
--- a/python/tvm/relay/frontend/tflite.py
+++ b/python/tvm/relay/frontend/tflite.py
@@ -1298,11 +1298,6 @@ class OperatorConverter(object):
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))
diff --git a/tests/python/frontend/tflite/test_forward.py
b/tests/python/frontend/tflite/test_forward.py
index d673c22adc..e85d370be5 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)