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

Function visit_if

python/tvm/relax/script/parser/parser.py:406–416  ·  view source on GitHub ↗
(self: Parser, node: doc.If)

Source from the content-addressed store, hash-verified

404
405@dispatch.register(token="relax", type_name="If")
406def visit_if(self: Parser, node: doc.If) -> None:
407 if node.orelse is None:
408 raise ValueError("Else statements are required for relax dialect.")
409 with R.If(self.eval_expr(node.test)) as if_frame:
410 with self.var_table.with_frame():
411 with R.Then():
412 self.visit_body(node.body)
413 with self.var_table.with_frame():
414 with R.Else():
415 self.visit_body(node.orelse)
416 self.var_table.add(if_frame.var_name, if_frame.var, allow_shadowing=True)
417
418
419@dispatch.register(token="relax", type_name="enter_token")

Callers

nothing calls this directly

Calls 4

eval_exprMethod · 0.80
with_frameMethod · 0.80
visit_bodyMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…