dpctl.tensor.place(arr, mask, vals)[source]

Change elements of an array based on conditional and input values.

If mask is boolean dpctl.tensor.place is equivalent to arr[condition] = vals.

  • arr (usm_ndarray) – Array to put data into.

  • mask (usm_ndarray) – Boolean mask array. Must have the same size as arr.

  • vals (usm_ndarray, sequence) – Values to put into arr. Only the first N elements are used, where N is the number of True values in mask. If vals is smaller than N, it will be repeated, and if elements of arr are to be masked, this sequence must be non-empty. Array vals must be one dimensional.