dpctl.tensor.unique_all

dpctl.tensor.unique_all(x)[source]

Returns the unique elements of an input array x, the first occurring indices for each unique element in x, the indices from the set of unique elements that reconstruct x, and the corresponding counts for each unique element in x.

Parameters:

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

Returns:

tuple[usm_ndarray, usm_ndarray, usm_ndarray, usm_ndarray]

a namedtuple (values, indices, inverse_indices, counts) 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 indices and is an array the indices (of first occurrences) of x that result in values. The array has the same shape as values and has the default array index data type.

  • third 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.

  • fourth element has the field name counts and is an array containing the number of times each unique element occurs in x. This array has the same shape as values and has the default array index data type.