You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2023/10/30 19:45:47 UTC

(tvm) branch unity updated: [Unity][UnitTest] Enable BindParams test for R.Prim (#15978)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/unity by this push:
     new d93260824b [Unity][UnitTest] Enable BindParams test for R.Prim (#15978)
d93260824b is described below

commit d93260824b42c0b989cb4a635f856c4afc6f1ef1
Author: Eric Lunderberg <Lu...@users.noreply.github.com>
AuthorDate: Mon Oct 30 14:45:41 2023 -0500

    [Unity][UnitTest] Enable BindParams test for R.Prim (#15978)
    
    This test was implemented in https://github.com/apache/tvm/pull/15626,
    but was initially disabled as it depended on functionality not
    introduced until https://github.com/apache/tvm/pull/15577.  Since that
    PR has landed, cleaning up and enabling the unit test.
---
 tests/python/relax/test_bind_params.py | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/python/relax/test_bind_params.py b/tests/python/relax/test_bind_params.py
index a92e4fe8e5..189a44303d 100644
--- a/tests/python/relax/test_bind_params.py
+++ b/tests/python/relax/test_bind_params.py
@@ -111,21 +111,23 @@ def test_bind_shape_param(param_shape):
 prim_value_dtype = tvm.testing.parameter("int64", "int32", "float32")
 
 
-@pytest.mark.xfail(reason="Depends on relax.PrimValue holding a tir.PrimExpr, PR#15577")
 def test_bind_prim_value(prim_value_dtype):
+    N = tir.Var("N", prim_value_dtype)
+    value = tir.const(16, prim_value_dtype)
+
     @R.function
-    def before(A: R.Prim(value="N", dtype=prim_value_dtype)):
+    def before(A: R.Prim(value=N)):
         R.func_attr({"global_symbol": "main"})
-        B: R.Prim(value="N", dtype=prim_value_dtype) = A
+        B: R.Prim(value=N) = A
         return B
 
     @R.function
-    def expected() -> R.Prim(value=16, dtype=prim_value_dtype):
+    def expected() -> R.Prim(value=value):
         R.func_attr({"global_symbol": "main"})
-        B = R.PrimValue(value=16, dtype=dtype)
+        B = R.prim_value(value)
         return B
 
-    after = before.bind_params({"A": relax.PrimValue(tir.const(16, prim_value_dtype))})
+    after = before.bind_params({"A": relax.PrimValue(value)})
 
     tvm.ir.assert_structural_equal(expected, after)