MCPcopy Create free account
hub / github.com/apache/tvm / test_var

Function test_var

tests/python/relax/test_analysis_well_formed.py:44–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43
44def test_var():
45 # Error: Var gv0 is not defined
46 gv0 = rx.Var("gv0", R.Tensor([m, n], "float32"))
47 gv1 = rx.Var("gv1", R.Tensor([m, n], "float32"))
48 call_node = rx.op.add(x, gv0)
49 bindings = [rx.VarBinding(gv1, call_node)]
50 blocks = [rx.BindingBlock(bindings)]
51 func = build_function(blocks)
52 mod = tvm.IRModule({rx.GlobalVar("foo"): func})
53 assert not rx.analysis.check_well_formed(mod, check_struct_info=False)
54
55 # Error: Var gv0 is defined more than once
56 gv0 = rx.Var("gv0", R.Tensor([m, n], "float32"))
57 call_node = rx.op.add(x, x)
58 call_node2 = rx.op.multiply(x, x)
59 bindings = [rx.VarBinding(gv0, call_node), rx.VarBinding(gv0, call_node2)]
60 blocks = [rx.BindingBlock(bindings)]
61 func = build_function(blocks)
62 mod = tvm.IRModule({rx.GlobalVar("foo"): func})
63 assert not rx.analysis.check_well_formed(mod, check_struct_info=False)
64
65
66def test_dataflow_var():

Callers

nothing calls this directly

Calls 4

build_functionFunction · 0.85
TensorMethod · 0.80
addMethod · 0.45
multiplyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…