summaryrefslogtreecommitdiff
path: root/numpy/array_api/_set_functions.py
diff options
context:
space:
mode:
authorAaron Meurer <asmeurer@gmail.com>2021-08-06 16:57:10 -0600
committerAaron Meurer <asmeurer@gmail.com>2021-08-06 16:57:10 -0600
commit4063752757a97c444b8913947a0890f2c2387bca (patch)
treefe543bfc277ea3933195801850f2681617e1f9a9 /numpy/array_api/_set_functions.py
parent2fe8643cce651fa2ada5619f85e3cc16524d4076 (diff)
downloadnumpy-4063752757a97c444b8913947a0890f2c2387bca.tar.gz
Fix the array API unique() function
Diffstat (limited to 'numpy/array_api/_set_functions.py')
-rw-r--r--numpy/array_api/_set_functions.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/array_api/_set_functions.py b/numpy/array_api/_set_functions.py
index f28c2ee72..acd59f597 100644
--- a/numpy/array_api/_set_functions.py
+++ b/numpy/array_api/_set_functions.py
@@ -12,4 +12,8 @@ def unique(x: Array, /, *, return_counts: bool = False, return_index: bool = Fal
See its docstring for more information.
"""
- return Array._new(np.unique(x._array, return_counts=return_counts, return_index=return_index, return_inverse=return_inverse))
+ res = np.unique(x._array, return_counts=return_counts,
+ return_index=return_index, return_inverse=return_inverse)
+ if isinstance(res, tuple):
+ return tuple(Array._new(i) for i in res)
+ return Array._new(res)