Script.where¶
- Script.where(condition, x, y, *, out=None)¶
Select elements from
xorybased on a boolean condition.Returns
xwhereconditionisTrue,yotherwise. Supports broadcasting. Scalar values forxoryare automatically promoted to tensors.- Parameters:
condition (RegisterTensor) – Boolean tensor determining element selection.
x (RegisterTensor | Expr | int | float) – Values selected where
conditionisTrue.y (RegisterTensor | Expr | int | float) – Values selected where
conditionisFalse.out (RegisterTensor, optional) – Output tensor. If not provided, a new tensor is allocated.
- Returns:
ret – Tensor with the same dtype as
xandy, broadcast to a common shape.- Return type:
Notes
Thread group: Can be executed by any sized thread group.