Skip to content

Commit

Permalink
[TFLite][Frontend] Support quantized SQUARE (#15914)
Browse files Browse the repository at this point in the history
* add quantized square

* add tests to quantized square
  • Loading branch information
tlopex authored Nov 9, 2023
1 parent 50597ce commit 99336c3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions python/tvm/relay/frontend/tflite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1298,11 +1298,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))

Expand Down
2 changes: 1 addition & 1 deletion tests/python/frontend/tflite/test_forward.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 99336c3

Please sign in to comment.