dpctl.tensor.where¶
- dpctl.tensor.where(condition, x1, x2, /, *, order='K', out=None)[source]¶
Returns
dpctl.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 (Union[usm_ndarray, bool, int, float, complex]) – Array from which values are chosen when
conditionisTrue. Must be compatible withconditionandx2according to broadcasting rules.x2 (Union[usm_ndarray, bool, int, float, complex]) – Array from which values are chosen when
conditionis notTrue. Must be compatible withconditionandx2according to broadcasting rules.order (
"K","C","F","A", optional) – Memory layout of the new output array, if parameteroutisNone. Default:"K".out (Optional[usm_ndarray]) – the array into which the result is written. The data type of out must match the expected shape and the expected data type of the result. If
Nonethen a new array is returned. Default:None.
- Returns:
An array with elements from
x1whereconditionisTrue, and elements fromx2elsewhere.- Return type:
The data type of the returned array is determined by applying the Type Promotion Rules to
x1andx2.