Skip to content

Commit 20d3dc5

Browse files
committed
add a fast-path for size == 1 arrays in sort
radix sort implementation asserts that array must be of size > 1
1 parent f7e0967 commit 20d3dc5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

dpctl/tensor/_sorting.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def sort(x, /, *, axis=-1, descending=False, stable=True, kind=None):
8585
return dpt.copy(x, order="C")
8686
else:
8787
axis = normalize_axis_index(axis, ndim=nd, msg_prefix="axis")
88+
if x.size == 1:
89+
return dpt.copy(x, order="C")
8890
a1 = axis + 1
8991
if a1 == nd:
9092
perm = list(range(nd))

0 commit comments

Comments
 (0)