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

Function normalize

tests/python/relax/test_ast_printer.py:43–58  ·  view source on GitHub ↗

Normalize the expr to fill in the struct_info fields everywhere

(func: rx.Function)

Source from the content-addressed store, hash-verified

41
42
43def normalize(func: rx.Function) -> rx.Function:
44 """
45 Normalize the expr to fill in the struct_info fields everywhere
46 """
47
48 # using a default mutator to use the BlockBuilder's normalizer,
49 # which oddly differs from the Normalize pass
50 @rx.expr_functor.mutator
51 class DefaultMutator(rx.PyExprMutator):
52 pass
53
54 mod = tvm.IRModule()
55 mod["main"] = func
56 mut = DefaultMutator(mod)
57 mod["main"] = mut.visit_expr(func)
58 return mod["main"]
59
60
61def assert_fields(nodename: str, fields: dict[str, str], target: str) -> None:

Callers 4

test_ifFunction · 0.70
test_tuple_get_itemFunction · 0.70

Calls 2

DefaultMutatorClass · 0.85
visit_exprMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…