Skip to content

Commit

Permalink
Add test based on example provided in gh-1738
Browse files Browse the repository at this point in the history
  • Loading branch information
oleksandr-pavlyk committed Jul 22, 2024
1 parent 3e6c9b6 commit 7e2c43c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions dpctl/tests/test_usm_ndarray_unique.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,3 +321,25 @@ def test_set_functions_compute_follows_data():
assert ind.sycl_queue == q
assert inv_ind.sycl_queue == q
assert uc.sycl_queue == q


def test_gh_1738():
get_queue_or_skip()

ones = dpt.ones(10, dtype="i8")
iota = dpt.arange(10, dtype="i8")

assert ones.device == iota.device

dpt_info = dpt.__array_namespace_info__()
ind_dt = dpt_info.default_dtypes(device=ones.device)["indexing"]

dt = dpt.unique_inverse(ones).inverse_indices.dtype
assert dt == ind_dt
dt = dpt.unique_all(ones).inverse_indices.dtype
assert dt == ind_dt

dt = dpt.unique_inverse(iota).inverse_indices.dtype
assert dt == ind_dt
dt = dpt.unique_all(iota).inverse_indices.dtype
assert dt == ind_dt

0 comments on commit 7e2c43c

Please sign in to comment.