triton.language.where¶
- triton.language.where(condition, x, y)¶
Returns a tensor of elements from either
x
ory
, depending oncondition
.Note that
x
andy
are always evaluated regardless of the value ofcondition
.If you want to avoid unintended memory operations, use the
mask
arguments in triton.load and triton.store instead.The shape of
x
andy
are both broadcast to the shape ofcondition
.x
andy
must have the same 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.