dpctl.tensor.extract

dpctl.tensor.extract(condition, arr)[source]

Returns the elements of an array that satisfies the condition.

If condition is boolean dpctl.tensor.extract is equivalent to arr[condition].

Note that dpctl.tensor.place does the opposite of dpctl.tensor.extract.

Parameters:
  • conditions (usm_ndarray) – An array whose non-zero or True entries indicate the element of arr to extract.

  • arr (usm_ndarray) – Input array of the same size as condition.

Returns:

Rank 1 array of values from arr where condition is True.

Return type:

usm_ndarray