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 e2e1d44c7c [TFLite][Frontend] Support quantized floor_mod (#15733)
e2e1d44c7c is described below

commit e2e1d44c7cb22f869275744b69865dc55b439313
Author: Anatol Liu <anatolx...@gmail.com>
AuthorDate: Thu Sep 14 05:27:48 2023 -0400

    [TFLite][Frontend] Support quantized floor_mod (#15733)
    
    As part of #15148, this PR adds support for floor_mod.
---
 python/tvm/relay/frontend/tflite.py          |  6 +-----
 tests/python/frontend/tflite/test_forward.py | 13 +++++++++++--
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/python/tvm/relay/frontend/tflite.py 
b/python/tvm/relay/frontend/tflite.py
index b33fd57b10..524b80d091 100644
--- a/python/tvm/relay/frontend/tflite.py
+++ b/python/tvm/relay/frontend/tflite.py
@@ -2690,11 +2690,7 @@ class OperatorConverter(object):
 
     def convert_floor_mod(self, op):
         """Convert TFLite FLOOR_MOD"""
-        if self.is_quantized(op):
-            raise tvm.error.OpNotImplemented(
-                "TFlite quantized FLOOR MOD operator is not supported yet."
-            )
-        return self._convert_elemwise(_op.floor_mod, op)
+        return self._convert_elemwise(_op.floor_mod, op, self.is_quantized(op))
 
     def convert_mirror_pad(self, op):
         """Convert TFLite MIRROR_PAD"""
diff --git a/tests/python/frontend/tflite/test_forward.py 
b/tests/python/frontend/tflite/test_forward.py
index 283514a6a3..c07f24612d 100644
--- a/tests/python/frontend/tflite/test_forward.py
+++ b/tests/python/frontend/tflite/test_forward.py
@@ -2764,9 +2764,16 @@ def _test_floor_divide(data, 
fused_activation_function=None, quantized=False, qn
 # ---------
 
 
-def _test_floor_mod(data):
+def _test_floor_mod(data, fused_activation_function=None, quantized=False, 
qnn_op=None):
     """One iteration of floor_mod"""
-    return _test_elemwise(math_ops.floormod, data)
+    return _test_elemwise(
+        math_ops.floormod,
+        data,
+        fused_activation_function,
+        quantized,
+        qnn_op,
+        same_qnn_params=True,
+    )
 
 
 def _test_forward_elemwise(testop):
@@ -2816,6 +2823,7 @@ def _test_elemwise_qnn_out_range(qnn_op):
         _test_greater: (-150, 150),
         _test_squared_difference: (0, 65025),
         _test_floor_divide: (-150, 150),
+        _test_floor_mod: (-150, 150),
     }
 
     return qnn_out_range[qnn_op]
@@ -2859,6 +2867,7 @@ def test_all_elemwise():
         _test_forward_elemwise(_test_floor_divide)
         _test_forward_elemwise_quantized(_test_floor_divide)
         _test_forward_elemwise(_test_floor_mod)
+        _test_forward_elemwise_quantized(_test_floor_mod)
 
 
 #######################################################################

Reply via email to