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

Function visit_expr_stmt

python/tvm/relax/script/parser/parser.py:313–330  ·  view source on GitHub ↗
(self: Parser, node: doc.Expr)

Source from the content-addressed store, hash-verified

311
312@dispatch.register(token="relax", type_name="Expr")
313def visit_expr_stmt(self: Parser, node: doc.Expr) -> None:
314 value = self.eval_expr(node.value)
315 if isinstance(value, relax.Expr):
316 var = R.emit(value)
317 IRBuilder.name("_", var)
318 is_void_value = (
319 isinstance(var.struct_info, relax.TupleStructInfo) and len(var.struct_info.fields) == 0
320 )
321
322 if not is_void_value:
323 self.report_error(
324 node,
325 f"Non-void relax expressions must be bound to a variable, "
326 f"but expression of type {var.struct_info} was used as a statement.",
327 )
328
329 elif value is not None:
330 self.report_error(node, f"Unsupported Expr stmt type {value}.")
331
332
333@dispatch.register(token="relax", type_name="arguments")

Callers

nothing calls this directly

Calls 4

eval_exprMethod · 0.80
report_errorMethod · 0.80
emitMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…