You are viewing a plain text version of this content. The canonical link for it is here.
Posted to discuss-archive@tvm.apache.org by "tlopex (via GitHub)" <gi...@apache.org> on 2026/06/25 07:33:23 UTC
[PR] [TFLite] Use structural checks in frontend tests [tvm]
tlopex opened a new pull request, #19888:
URL: https://github.com/apache/tvm/pull/19888
This pr
- Replaces script-string based TFLite frontend IR checks with structural checks.
- Keeps numeric/runtime tests focused on VM output validation instead of mixing in structural assertions.
- Leaves the shared `verify` helper unchanged and use direct `tvm.ir.assert_structural_equal` where structural checks are needed.
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [TFLite] Use structural checks in frontend tests [tvm]
Posted by "tqchen (via GitHub)" <gi...@apache.org>.
tqchen merged PR #19888:
URL: https://github.com/apache/tvm/pull/19888
--
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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org
Re: [PR] [TFLite] Use structural checks in frontend tests [tvm]
Posted by "gemini-code-assist[bot] (via GitHub)" <gi...@apache.org>.
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:

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:

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: discuss-archive-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: discuss-archive-unsubscribe@tvm.apache.org
For additional commands, e-mail: discuss-archive-help@tvm.apache.org