You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/12/18 08:43:45 UTC

[GitHub] [tvm] wrongtest-intellif commented on a diff in pull request #13640: [BugFix][TVMScript]fix var capturing order error.

wrongtest-intellif commented on code in PR #13640:
URL: https://github.com/apache/tvm/pull/13640#discussion_r1051548626


##########
tests/python/unittest/test_tvmscript_regression.py:
##########
@@ -58,7 +58,24 @@ def func_ref():
     tvm.ir.assert_structural_equal(test_case, func_ref)
 
 
+def test_var_capturing_order():
+    b = 2
+
+    @T.prim_func
+    def test_case():
+        k: T.int32 = b
+
+    @T.prim_func
+    def func_ref():
+        k: T.int32 = 2
+        T.evaluate(0)
+
+    tvm.ir.assert_structural_equal(test_case, func_ref)
+
+
 if __name__ == "__main__":
+    b = 1

Review Comment:
   Could we put it just before line `def test_var_capturing_order():` thus people could know what is the purpose this assignment is for. Also just for my curiosity, what the behavior when there are nested closures? 



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