dpctl.tensor.unique_inverse

dpctl.tensor.unique_inverse(x)[source]

Returns the unique elements of an input array x and the indices from the set of unique elements that reconstruct x.

Parameters:

x (usm_ndarray) – input array. Inputs with more than one dimension are flattened.

Returns:

tuple[usm_ndarray, usm_ndarray]

a namedtuple (values, inverse_indices) whose

  • first element has the field name values and is an array containing the unique elements of x. The array has the same data type as x.

  • second element has the field name inverse_indices and is an array containing the indices of values that reconstruct x. The array has the same shape as x and has the default array index data type.