Skip to content

Commit 71eb2fc

Browse files
Add a test for non-contiguous input
1 parent b67d05c commit 71eb2fc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

dpctl/tests/test_usm_ndarray_top_k.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,15 @@ def test_top_k_2d_smallest(dtype, n):
264264
dpt.sort(r.indices, axis=1) == dpt.sort(expected_inds, axis=1)
265265
)
266266
assert dpt.all(dpt.sort(r.values, axis=1) == dpt.sort(x[:, :k], axis=1))
267+
268+
269+
def test_top_k_noncontig():
270+
get_queue_or_skip()
271+
272+
a = dpt.arange(256, dtype=dpt.int32)[::2]
273+
r = dpt.top_k(a, 3)
274+
275+
assert dpt.all(dpt.sort(r.values) == dpt.asarray([250, 252, 254])), r.values
276+
assert dpt.all(
277+
dpt.sort(r.indices) == dpt.asarray([125, 126, 127])
278+
), r.indices

0 commit comments

Comments
 (0)