This is an automated email from the ASF dual-hosted git repository.

lukhut 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 646d3a2c5e [TFLite][Frontend] Support quantized Pow (#15798)
646d3a2c5e is described below

commit 646d3a2c5ea23939f29c3b792801825818f0ca37
Author: Tlopex <68688494+tlo...@users.noreply.github.com>
AuthorDate: Tue Oct 3 22:20:03 2023 +0800

    [TFLite][Frontend] Support quantized Pow (#15798)
    
    Support POW quantization operation as part of #15148
---
 python/tvm/relay/frontend/tflite.py          |  2 --
 tests/python/frontend/tflite/test_forward.py | 13 +++++++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/python/tvm/relay/frontend/tflite.py 
b/python/tvm/relay/frontend/tflite.py
index 4eaa8280c3..532318b804 100644
--- a/python/tvm/relay/frontend/tflite.py
+++ b/python/tvm/relay/frontend/tflite.py
@@ -1434,8 +1434,6 @@ class OperatorConverter(object):
     def convert_pow(self, op):
         """Convert TFLite POW"""
         # Check if the input tensor is quantized, call QNN op
-        if self.is_quantized(op):
-            raise tvm.error.OpNotImplemented("TFlite quantized POW operator is 
not supported yet.")
         return self._convert_elemwise(_op.power, op)
 
     def convert_maximum(self, op):
diff --git a/tests/python/frontend/tflite/test_forward.py 
b/tests/python/frontend/tflite/test_forward.py
index 4e86633b79..d9a53fd517 100644
--- a/tests/python/frontend/tflite/test_forward.py
+++ b/tests/python/frontend/tflite/test_forward.py
@@ -2627,9 +2627,16 @@ def _test_div(data, fused_activation_function=None, 
quantized=False, qnn_op=None
 # -----
 
 
-def _test_pow(data):
+def _test_pow(data, fused_activation_function=None, quantized=False, 
qnn_op=None):
     """One iteration of power"""
-    return _test_elemwise(math_ops.pow, data)
+    return _test_elemwise(
+        math_ops.pow,
+        data,
+        fused_activation_function,
+        quantized,
+        qnn_op,
+        same_qnn_params=True,
+    )
 
 
 #######################################################################
@@ -2866,6 +2873,7 @@ def _test_elemwise_qnn_out_range(qnn_op):
         _test_less: (-150, 150),
         _test_floor_mod: (-150, 150),
         _test_not_equal: (-150, 150),
+        _test_pow: (0, 3),
         _test_less_equal: (-150, 150),
         _test_greater_equal: (-150, 150),
     }
@@ -2894,6 +2902,7 @@ def test_all_elemwise():
     _test_forward_elemwise(partial(_test_div, 
fused_activation_function="RELU6"))
     _test_forward_elemwise_quantized(_test_div)
     _test_forward_elemwise(_test_pow)
+    _test_forward_elemwise_quantized(_test_pow)
     _test_forward_elemwise(_test_maximum)
     _test_forward_elemwise_quantized(_test_maximum)
     _test_forward_elemwise(_test_minimum)

Reply via email to