MCPcopy Index your code
hub / github.com/apache/tvm / visit_with

Function visit_with

python/tvm/relax/script/parser/parser.py:351–368  ·  view source on GitHub ↗
(self: Parser, node: doc.With)

Source from the content-addressed store, hash-verified

349
350@dispatch.register(token="relax", type_name="With")
351def visit_with(self: Parser, node: doc.With) -> None:
352 # Currently only `with R.dataflow()` is supported
353 if len(node.items) != 1:
354 self.report_error(node, "Only one item is allowed.")
355 item = node.items[0]
356 if item.optional_vars is not None:
357 self.report_error(
358 item.context_expr,
359 "Relax syntax doesn't allow binding expressions in `with` to variables",
360 )
361 frame = self.eval_expr(item.context_expr)
362 with self.var_table.with_frame():
363 with frame:
364 self.visit(node.body)
365 if isinstance(frame, BindingBlockFrame) and frame.is_dataflow:
366 output_vars = frame.output_vars
367 for var in output_vars:
368 self.var_table.add(var.name_hint, var, allow_shadowing=True)
369
370
371@dispatch.register(token="relax", type_name="Assign")

Callers

nothing calls this directly

Calls 5

report_errorMethod · 0.80
eval_exprMethod · 0.80
with_frameMethod · 0.80
visitMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…