tvm_tirx.script.ir_builder.parser_protocol.range_

Contents

tvm_tirx.script.ir_builder.parser_protocol.range_#

tvm_tirx.script.ir_builder.parser_protocol.range_(*args, annotations=None)#

Normalize builtin range syntax to a native serial loop frame.

Parameters:
  • args (Expr or int) – One to three already-evaluated bounds: stop; start, stop; or start, stop, step. Omitted start is zero and omitted step uses the native default.

  • annotations (dict, optional) – Native loop annotations. None (the default) adds none.

Returns:

IRBuilderFrame – An unentered serial loop frame; for_ configures names and source location.

Return type:

IRBuilderFrame

Notes

TIRx validates arity and rejects a literal zero step (TypeError/ValueError). Native bound/type diagnostics propagate. Relax raises TypeError. Only the resolved builtin range is normalized; unrelated host callables named range retain ordinary call behavior.

# Source
for i in range(2, n, 2):
    pass
# Generated builder iteration specification
X.range_(2, n, 2)