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 9f05c9891f [TFLite][Frontend] Support quantized GREATER_EQUAL (#15775)
9f05c9891f is described below

commit 9f05c9891f125206bd2ee38e470e13836b119788
Author: Tlopex <[email protected]>
AuthorDate: Thu Sep 21 16:03:02 2023 +0800

    [TFLite][Frontend] Support quantized GREATER_EQUAL (#15775)
    
    Support GREATER_EQUAL quantization operation as part of #15148
---
 python/tvm/relay/frontend/tflite.py          |  8 +++-----
 tests/python/frontend/tflite/test_forward.py | 14 ++++++++++++--
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/python/tvm/relay/frontend/tflite.py 
b/python/tvm/relay/frontend/tflite.py
index 6728263c7f..9e72049ecd 100644
--- a/python/tvm/relay/frontend/tflite.py
+++ b/python/tvm/relay/frontend/tflite.py
@@ -1474,11 +1474,9 @@ class OperatorConverter(object):
 
     def convert_greater_equal(self, op):
         """Convert TFLite GREATER_EQUAL"""
-        if self.is_quantized(op):
-            raise tvm.error.OpNotImplemented(
-                "TFlite quantized GREATER_EQUAL operator is not supported yet."
-            )
-        return self._convert_elemwise(_op.greater_equal, op)
+        return self._convert_elemwise(
+            _op.greater_equal, op, self.is_quantized(op), comparison_op=True
+        )
 
     def convert_less(self, op):
         """Convert TFLite LESS"""
diff --git a/tests/python/frontend/tflite/test_forward.py 
b/tests/python/frontend/tflite/test_forward.py
index ab89de6301..b981145c1c 100644
--- a/tests/python/frontend/tflite/test_forward.py
+++ b/tests/python/frontend/tflite/test_forward.py
@@ -2679,9 +2679,17 @@ def _test_greater(data, fused_activation_function=None, 
quantized=False, qnn_op=
 # -------------
 
 
-def _test_greater_equal(data):
+def _test_greater_equal(data, fused_activation_function=None, quantized=False, 
qnn_op=None):
     """One iteration of greater_equal"""
-    return _test_elemwise(math_ops.greater_equal, data)
+    return _test_elemwise(
+        math_ops.greater_equal,
+        data,
+        fused_activation_function,
+        quantized,
+        qnn_op,
+        same_qnn_params=True,
+        comparison_op=True,
+    )
 
 
 #######################################################################
@@ -2850,6 +2858,7 @@ def _test_elemwise_qnn_out_range(qnn_op):
         _test_less: (-150, 150),
         _test_floor_mod: (-150, 150),
         _test_not_equal: (-150, 150),
+        _test_greater_equal: (-150, 150),
     }
 
     return qnn_out_range[qnn_op]
@@ -2885,6 +2894,7 @@ def test_all_elemwise():
     _test_forward_elemwise(_test_squared_difference)
     _test_forward_elemwise_quantized(_test_squared_difference, np.int8)
     _test_forward_elemwise(_test_greater_equal)
+    _test_forward_elemwise_quantized(_test_greater_equal)
     _test_forward_elemwise(_test_less)
     _test_forward_elemwise_quantized(_test_less)
     _test_forward_elemwise(_test_less_equal)

Reply via email to