Skip to content

Commit 919e82e

Browse files
Add a test for valid call on 0d input array
1 parent c39fdbe commit 919e82e

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
@@ -266,6 +266,18 @@ def test_top_k_2d_smallest(dtype, n):
266266
assert dpt.all(dpt.sort(r.values, axis=1) == dpt.sort(x[:, :k], axis=1))
267267

268268

269+
def test_top_k_0d():
270+
get_queue_or_skip()
271+
272+
a = dpt.ones(tuple(), dtype="i4")
273+
assert a.ndim == 0
274+
assert a.size == 1
275+
276+
r = dpt.top_k(a, 1)
277+
assert r.values == a
278+
assert r.indices == dpt.zeros_like(a, dtype=r.indices.dtype)
279+
280+
269281
def test_top_k_noncontig():
270282
get_queue_or_skip()
271283

0 commit comments

Comments
 (0)