summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_set_functions.py
blob: f5cd6d324a4c6055b25a9aa7cfd0afea40a6d59c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from __future__ import annotations

from ._types import Tuple, Union, array
from ._array_object import ndarray

import numpy as np

def unique(x: array, /, *, return_counts: bool = False, return_index: bool = False, return_inverse: bool = False) -> Union[array, Tuple[array, ...]]:
    """
    Array API compatible wrapper for :py:func:`np.unique <numpy.unique>`.

    See its docstring for more information.
    """
    return ndarray._new(np.unique(x._array, return_counts=return_counts, return_index=return_index, return_inverse=return_inverse))