tvm_tirx.script.ir_builder.with_at_group_

Contents

tvm_tirx.script.ir_builder.with_at_group_#

tvm_tirx.script.ir_builder.with_at_group_(location, thunk, *, attach_result=True)#

Evaluate once under a location, optionally attaching it to the same result.

Parameters:
  • location (LocationEntry, Location) – Source context for the call. None, UnknownLoc, or no active builder leaves construction context unchanged.

  • thunk (Callable[[], Any]) – Zero-argument callable evaluated exactly once inside that context.

  • attach_result (bool, optional) – Attach the location to the returned object with at_(). Defaults to True. False supplies construction context only, leaving explicit result attachment to a later operation.

Returns:

Any – The exact result of thunk, with its receipt or container preserved.

Return type:

_T

Notes

The prior source context is restored even if the callable raises; its exception propagates unchanged. Frames created during the call retain their construction locations regardless of attach_result.