triton.language.where¶
- triton.language.where(condition, x, y, builder=None)¶
Returns a block of elements from either
xory, depending oncondition.Note that
xandyare always evaluated regardless of the value ofcondition.If you want to avoid unintented memory operations, use the
maskarguments in triton.load and triton.store instead.The shape of
xandyare both broadcast to the shape ofcondition.xandymust have the data type.- Parameters
condition (Block of triton.bool) – When True (nonzero), yield x, otherwise yield y.
x – values selected at indices where condition is True.
y – values selected at indices where condition is False.
builder (triton.ir.builder, optional from within JIT'ed functions) – IR builder to generate code into