dpnp.unique_inverse¶
- dpnp.unique_inverse(x, /)[source]¶
Find the unique elements of x and indices to reconstruct x.
For full documentation refer to
numpy.unique_inverse.- Parameters:
- x{dpnp.ndarray, usm_ndarray}
Input array. It will be flattened if it is not already 1-D.
- Returns:
- A namedtuple with the following attributes:
- valuesdpnp.ndarray
The unique elements of an input array.
- inverse_indicesdpnp.ndarray
The indices from the set of unique elements that reconstruct x.
See also
dpnp.uniqueFind the unique elements of an array.
Examples
>>> import dpnp as np >>> x = np.array([1, 1, 2]) >>> uniq = np.unique_inverse(x) >>> uniq.values array([1, 2]) >>> uniq.inverse_indices array([0, 0, 1])