tvm_tirx.script.ir_builder.parser_protocol.if_then_else_

Contents

tvm_tirx.script.ir_builder.parser_protocol.if_then_else_#

tvm_tirx.script.ir_builder.parser_protocol.if_then_else_(condition, true_value, false_value)#

Construct conditional evaluation from eagerly constructed operands.

Parameters:
  • condition (Any) – Host boolean or scalar IR predicate.

  • true_value (Any) – Already-constructed true arm.

  • false_value (Any) – Already-constructed false arm.

Returns:

Any – The selected host value or native conditional expression.

Return type:

Any

Notes

No statement emission or frame entry occurs. Host predicates select an existing value; scalar IR uses conditional evaluation. Relax also accepts its expression arms. Operand construction remains eager; runtime evaluation follows language variant conditional semantics. Invalid combinations raise native type errors. Source-result handling supplies locs.

# Source
yes if condition else no
# Generated builder
X.if_then_else_(condition, yes, no)