cupy.unique_all#
- cupy.unique_all(x)[source]#
Find the unique elements of an array, and counts, inverse and indices.
This function is an Array API compatible alternative to:
>>> x = cupy.array([1, 1, 2]) >>> np.unique(x, return_index=True, return_inverse=True, ... return_counts=True, equal_nan=False) (array([1, 2]), array([0, 2]), array([0, 0, 1]), array([2, 1]))
- Parameters:
x (ndarray) – Input array. It will be flattened if it is not already 1-D.
- Returns:
out – The result containing:
values - The unique elements of an input array.
indices - The first occurring indices for each unique element.
inverse_indices - The indices from the set of unique elements that reconstruct x.
counts - The corresponding counts for each unique element.
- Return type:
namedtuple