tvm_tirx.script.ir_builder.parser_protocol.return_

Contents

tvm_tirx.script.ir_builder.parser_protocol.return_#

tvm_tirx.script.ir_builder.parser_protocol.return_(value=None, *, loc=None)#

Record a language variant function return while continuing Python construction.

Parameters:
  • value (Any, optional) – Return operand. None (the default) means an empty tuple in Relax; TIRx requires an expression.

  • loc (LocationEntry, Location or None, optional) – Location for the constructed result. None (the default) leaves explicit location unspecified; active source-call provenance is composed by the builder. Frames retain their location until finalization.

Returns:

AlreadyEmitted[Any] | None – Receipt retaining the exact emitted statement; consuming it emits nothing again. Relax records a function result and returns None.

Return type:

AlreadyEmitted[Any] | None

Notes

Requires an active function/region. TIRx emits its native return operation; Relax records the function result. Unsupported missing/type/context combinations raise TypeError or native errors. A source macro retaining ordinary Python return does not call this hook.

# Source
return value
# Generated builder
X.return_(value)