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


##########
tests/python/relax/test_frontend_from_exported_program.py:
##########
@@ -3251,9 +3251,23 @@ def main(
                 R.output(gv)
             return gv
 
+    @tvm.script.ir_module
+    class expected3:
+        @R.function
+        def main(data: R.Tensor((3, 1, 3), dtype="float32")) -> 
R.Tuple(R.Tensor((3, 3), dtype="float32")):
+            with R.dataflow():
+                lv: R.Tensor((3, 3), dtype="float32") = R.squeeze(data, 
axis=[1])
+                lv1: R.Tuple(R.Tensor((3, 3), dtype="float32")) = (lv,)
+                lv2: R.Tensor((3, 3), dtype="float32") = lv1[0]
+                gv: R.Tuple(R.Tensor((3, 3), dtype="float32")) = (lv2,)
+                R.output(gv)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The IR in `expected3` seems unnecessarily verbose. The sequence of creating 
a tuple, unpacking it, and then repacking it can be simplified. This would make 
the test clearer and more maintainable.
   
   If the frontend generates this verbose IR, this might point to an 
opportunity for simplification in the translator itself. However, simplifying 
the test's expected IR is a good first step for readability.
   
   ```suggestion
                   lv: R.Tensor((3, 3), dtype="float32") = R.squeeze(data, 
axis=[1])
                   gv: R.Tuple(R.Tensor((3, 3), dtype="float32")) = (lv,)
                   R.output(gv)
   ```



-- 
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]

Reply via email to