dpnp.tensor.where¶
- dpnp.tensor.where(condition, x1, x2, /, *, order='K', out=None)[source]¶
Returns
dpnp.tensor.usm_ndarraywith elements chosen fromx1orx2depending oncondition.- Parameters:
condition (usm_ndarray) -- When
Trueyields fromx1, and otherwise yields fromx2. Must be compatible withx1andx2according to broadcasting rules.x1 ({usm_ndarray, bool, int, float, complex}) -- Array from which values are chosen when
conditionisTrue. Must be compatible withconditionandx2according to broadcasting rules.x2 ({usm_ndarray, bool, int, float, complex}) -- Array from which values are chosen when
conditionis notTrue. Must be compatible withconditionandx1according to broadcasting rules.order ({"K", "C", "F", "A"}, optional) --
Memory layout of the new output array, if parameter
outisNone.Default:
"K".out ({None, usm_ndarray}, optional) --
The array into which the result is written. The data type of
outmust match the expected shape and the expected data type of the result. IfNonethen a new array is returned.Default:
None.
- Returns:
out (usm_ndarray) -- An array with elements from
x1whereconditionisTrue,
and elements from
x2elsewhere.