From ad55fea063ab412af0861bca4567574368030b3d Mon Sep 17 00:00:00 2001 From: crusaderky Date: Fri, 16 May 2025 11:02:22 +0100 Subject: [PATCH] MAINT: `reshape` does not accept int --- src/array_api_extra/_lib/_funcs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/array_api_extra/_lib/_funcs.py b/src/array_api_extra/_lib/_funcs.py index e552392b..bb39775f 100644 --- a/src/array_api_extra/_lib/_funcs.py +++ b/src/array_api_extra/_lib/_funcs.py @@ -725,7 +725,8 @@ def nunique(x: Array, /, *, xp: ModuleType | None = None) -> Array: return xp.asarray(n, device=_compat.device(x)) # xp does not have unique_counts; O(n*logn) complexity - x = xp.sort(xp.reshape(x, -1)) + x = xp.reshape(x, (-1,)) + x = xp.sort(x) mask = x != xp.roll(x, -1) default_int = xp.__array_namespace_info__().default_dtypes( device=_compat.device(x)