You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "sunggg (via GitHub)" <gi...@apache.org> on 2023/03/13 02:41:30 UTC

[GitHub] [tvm] sunggg commented on a diff in pull request #14282: [Unity][BuiltinOp][Transform] Introduce data-dependent operation of reshape and its constant folding

sunggg commented on code in PR #14282:
URL: https://github.com/apache/tvm/pull/14282#discussion_r1133395206


##########
tests/python/relax/test_relax_operators.py:
##########
@@ -193,5 +193,21 @@ def test_op_shape_of():
     assert constrained_shape == tvm.runtime.ShapeTuple([1])
 
 
+@tvm.script.ir_module
+class TensorToShapeTest:
+    @R.function
+    def run_tensor_to_shape(t: R.Tensor(ndim=1, dtype="int64")) -> R.Shape((1, 2, 3)):
+        gv: R.Shape(ndim=3) = R.tensor_to_shape(t)
+        return gv
+
+
+def test_op_tensor_to_shape():
+    out_shape = run_cpu(
+        TensorToShapeTest, "run_tensor_to_shape", tvm.nd.array(np.array([1, 2, 3]).astype("int64"))
+    )
+    assert out_shape == tvm.runtime.ShapeTuple([1, 2, 3])
+
+
 if __name__ == "__main__":
-    tvm.testing.main()
+    test_op_tensor_to_shape()

Review Comment:
   oops! Thanks for the catch :) 



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org