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 b3eec91ee6 [TFLite] Add support for quantized mirror pad (#16243)
b3eec91ee6 is described below

commit b3eec91ee6254b40920c40e922cb3c37ac1c06a4
Author: Luke Hutton <luke.hut...@arm.com>
AuthorDate: Fri Dec 15 10:54:14 2023 +0000

    [TFLite] Add support for quantized mirror pad (#16243)
    
    Removes the restriction on converting quantized mirror pad in the
    front-end and adds tests to support this change.
    
    Change-Id: Id513709b38e6bfdcff2bb35554b6799ef5c5cd52
---
 python/tvm/relay/frontend/tflite.py          |  6 ------
 tests/python/frontend/tflite/test_forward.py | 24 +++++++++++++++++++++++-
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/python/tvm/relay/frontend/tflite.py 
b/python/tvm/relay/frontend/tflite.py
index 1880887b7e..3648864239 100644
--- a/python/tvm/relay/frontend/tflite.py
+++ b/python/tvm/relay/frontend/tflite.py
@@ -2677,12 +2677,6 @@ class OperatorConverter(object):
         except ImportError:
             raise ImportError("The tflite package must be installed")
 
-        # the quantized form MirrorPad is not yet implemented in TFLite.
-        if self.is_quantized(op):
-            raise tvm.error.OpNotImplemented(
-                "TFlite quantized MIRROR_PAD operator is not supported yet."
-            )
-
         input_tensors = self.get_input_tensors(op)
         assert len(input_tensors) == 2, "input tensors length should be 2"
 
diff --git a/tests/python/frontend/tflite/test_forward.py 
b/tests/python/frontend/tflite/test_forward.py
index e85d370be5..6d1e656221 100644
--- a/tests/python/frontend/tflite/test_forward.py
+++ b/tests/python/frontend/tflite/test_forward.py
@@ -3436,7 +3436,13 @@ def _test_pad(data, mode="CONSTANT", quantized=False):
                 inq_data[0], ops.convert_to_tensor(data[1], 
dtype=data[1].dtype), mode=mode
             )
             compare_tflite_with_tvm(
-                [data[0]], ["inq_0:0"], inq_data, [out], quantized=True, 
input_range=input_range
+                [data[0]],
+                ["inq_0:0"],
+                inq_data,
+                [out],
+                quantized=True,
+                input_range=input_range,
+                experimental_new_converter=True,
             )
         else:
             out = array_ops.pad(
@@ -3506,6 +3512,22 @@ def test_forward_pad():
         ],
         quantized=True,
     )
+    _test_pad(
+        [
+            np.arange(0, 256, dtype=np.uint8).reshape((1, 256)),
+            np.array([[1, 1], [2, 2]], dtype=np.int32),
+        ],
+        quantized=True,
+        mode="SYMMETRIC",
+    )
+    _test_pad(
+        [
+            np.arange(0, 256, dtype=np.uint8).reshape((1, 256)),
+            np.array([[0, 0], [2, 2]], dtype=np.int32),
+        ],
+        quantized=True,
+        mode="REFLECT",
+    )
 
 
 #######################################################################

Reply via email to