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

Function test_if

tests/python/relax/test_ast_printer.py:620–635  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

618
619
620def test_if():
621 @R.function
622 def f(cond: R.Tensor((), dtype="bool")) -> R.Tensor((), dtype="int32"):
623 if cond:
624 x = R.const(1)
625 else:
626 x = R.const(2)
627 return x
628
629 body = normalize(f).body
630 assert isinstance(body, rx.SeqExpr)
631 body_str = strip_whitespace(dump_ast(body))
632 # we expect both branches to be seq exprs
633 assert "If" in body_str
634 assert "true_branch=SeqExpr(" in body_str
635 assert "false_branch=SeqExpr(" in body_str
636
637
638def test_tuple_get_item():

Callers

nothing calls this directly

Calls 3

dump_astFunction · 0.90
strip_whitespaceFunction · 0.85
normalizeFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…