Skip to content

Commit 4063752

Browse files
committed
Fix the array API unique() function
1 parent 2fe8643 commit 4063752

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpy/array_api/_set_functions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ def unique(x: Array, /, *, return_counts: bool = False, return_index: bool = Fal
1212
1313
See its docstring for more information.
1414
"""
15-
return Array._new(np.unique(x._array, return_counts=return_counts, return_index=return_index, return_inverse=return_inverse))
15+
res = np.unique(x._array, return_counts=return_counts,
16+
return_index=return_index, return_inverse=return_inverse)
17+
if isinstance(res, tuple):
18+
return tuple(Array._new(i) for i in res)
19+
return Array._new(res)

0 commit comments

Comments
 (0)