gemini-code-assist[bot] commented on code in PR #19888:
URL: https://github.com/apache/tvm/pull/19888#discussion_r3472654343


##########
tests/python/relax/test_frontend_tflite.py:
##########
@@ -530,10 +636,28 @@ class Unique(tf.Module):
         def func(self, x):
             return tf.raw_ops.Unique(x=x, out_idx=tf.int64)
 
+    @I.ir_module
+    class Expected:
+        @R.function
+        def main(
+            x: R.Tensor((6,), dtype="int32"),
+        ) -> R.Tuple(R.Tensor(dtype="int32", ndim=1), R.Tensor(dtype="int64", 
ndim=1)):
+            R.func_attr({"num_input": 1})
+            with R.dataflow():
+                lv: R.Tuple(
+                    R.Tensor(dtype="int32", ndim=1), R.Tensor(dtype="int64", 
ndim=1)
+                ) = R.unique(x, R.prim_value(0), R.prim_value(0), 
R.prim_value(1), R.prim_value(0))
+                lv1: R.Tensor(dtype="int32", ndim=1) = lv[0]
+                lv2: R.Tensor(dtype="int64", ndim=1) = lv[1]
+                gv: R.Tuple(R.Tensor(dtype="int32", ndim=1), 
R.Tensor(dtype="int64", ndim=1)) = (
+                    lv1,
+                    lv2,
+                )
+                R.output(gv)
+            return gv
+
     mod = _get_mod_from_cfunc(Unique().func.get_concrete_function())
-    values, inverse_indices = _run_module(mod, np.array([3, 1, 3, 2, 1, 2], 
dtype=np.int32))
-    np.testing.assert_array_equal(values, np.array([3, 1, 2], dtype=np.int32))
-    np.testing.assert_array_equal(inverse_indices, np.array([0, 1, 0, 2, 1, 
2], dtype=np.int64))
+    tvm.ir.assert_structural_equal(mod, Expected)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   In `test_unique`, the runtime execution test (`_run_module` and its 
assertions) was completely removed and replaced with a structural check. To 
maintain test coverage for the `Unique` operator's runtime behavior, please 
keep the execution check alongside the new structural check.
   
   ```suggestion
       mod = _get_mod_from_cfunc(Unique().func.get_concrete_function())
       tvm.ir.assert_structural_equal(mod, Expected)
       values, inverse_indices = _run_module(mod, np.array([3, 1, 3, 2, 1, 2], 
dtype=np.int32))
       np.testing.assert_array_equal(values, np.array([3, 1, 2], 
dtype=np.int32))
       np.testing.assert_array_equal(inverse_indices, np.array([0, 1, 0, 2, 1, 
2], dtype=np.int64))
   ```



##########
tests/python/relax/test_frontend_tflite.py:
##########
@@ -1660,11 +2217,6 @@ def main(
                 R.output(gv)
             return gv
 
-    tvm.ir.assert_structural_equal(mod, Expected)
-    ir = mod.script()
-    assert "R.reverse_sequence" in ir
-    assert 'R.call_dps_packed("topi.reverse_sequence"' not in ir
-
     data = np.arange(24, dtype="float32").reshape((2, 4, 3))

Review Comment:
   ![high](https://www.gstatic.com/codereviewagent/high-priority.svg)
   
   In `test_reverse_sequence`, the structural assertion 
`tvm.ir.assert_structural_equal(mod, Expected)` was accidentally removed along 
with the string-based IR checks. This leaves the defined `Expected` IR module 
unused and disables the structural test for `reverse_sequence`. Please restore 
the structural assertion.
   
   ```suggestion
               return gv
   
       tvm.ir.assert_structural_equal(mod, Expected)
   
       data = np.arange(24, dtype="float32").reshape((2, 4, 3))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to