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


##########
tests/python/relax/test_frontend_onnx.py:
##########
@@ -3934,21 +3928,16 @@ def test_dynamic_shape_squeeze(axis):
     assert len(tvm_model["main"].attrs["params"]) == 1
     tvm_model["main"] = tvm_model["main"].without_attr("params")
 
-    @I.ir_module
-    class Expected:
-        @R.function
-        def main(
-            x: R.Tensor(("A",), dtype="float32"),
-            axes: R.Tensor((1,), dtype="int64"),
-        ) -> T.int64:
-            A = T.int64(is_size_var=True)
-            R.func_attr({"num_input": 1})
-            with R.dataflow():
-                gv: T.int64 = R.prim_value(A)
-                R.output(gv)
-            return gv
-
-    tvm.ir.assert_structural_equal(tvm_model, Expected)
+    # TVMScript cannot currently round-trip this SizeVar dataflow binding.
+    a = tvm.tirx.SizeVar("A", "int64")
+    x = relax.Var("x", relax.TensorType([a], "float32"))
+    axes = relax.Var("axes", relax.TensorType([1], "int64"))

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   There are two issues here that will cause the test to crash at runtime:
   
   1. `tvm.tirx` is not a valid module. It should be `tvm.tir.SizeVar`.
   2. `relax.TensorType` represents the type of a tensor (which only has `ndim` 
and `dtype` as parameters) and cannot be constructed with a shape list like 
`[a]` or `[1]`. Instead, use `relax.TensorStructInfo` to specify the shape and 
data type of the variables.
   
   ```suggestion
       a = tvm.tir.SizeVar("A", "int64")
       x = relax.Var("x", relax.TensorStructInfo([a], "float32"))
       axes = relax.Var("axes", relax.TensorStructInfo([1], "int64"))
   ```



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