tvm_tirx.ir.prim.if_then_else

Contents

tvm_tirx.ir.prim.if_then_else#

tvm_tirx.ir.prim.if_then_else(cond, t, f, loc=UNKNOWN_LOC)#

Conditional selection expression.

Parameters:
  • cond (Expr) – The condition

  • t (Expr) – The result expression if cond is true.

  • f (Expr) – The result expression if cond is false.

  • loc (Location, optional) – The location of this operator in the source.

Returns:

result (Node) – The result of conditional expression.

Note

Unlike Select, if_then_else will not execute the branch that does not satisfy the condition. You can use it to guard against out of bound access. Unlike Select, if_then_else cannot be vectorized if some lanes in the vector have different conditions.