tvm_tirx.script.ir_builder.parser_protocol.setattr_

Contents

tvm_tirx.script.ir_builder.parser_protocol.setattr_#

tvm_tirx.script.ir_builder.parser_protocol.setattr_(target, name, value, *, loc=None)#

Apply an attribute assignment using already-evaluated operands.

Parameters:
  • target (Any) – Object containing a scalar storage attribute or ordinary mutable Python metadata.

  • name (str) – Attribute identifier, evaluated by source syntax before this hook.

  • value (Any) – Once-evaluated replacement or stored value.

  • 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. Ordinary host attribute updates return None because they emit no IR statement.

Return type:

AlreadyEmitted[Any] | None

Notes

TIRx stores through scalar storage attributes without replacing their handles; other attributes use ordinary Python setattr. Native store checks and Python attribute errors propagate. Relax raises TypeError. A native store needs an active function; ordinary host metadata updates do not.

# Source
state.count = value
# Generated builder
X.setattr_(state, "count", value)