Fix the array API unique() function
@@ -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)
