Skip to content

Workaround to dpnp.allclose() #1568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions dpnp/backend/kernels/dpnp_krnl_logic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,28 @@ static sycl::event dpnp_allclose(sycl::queue &q,
partial &= (array1[i] == array2[i]);
continue;
}

// workaround for std::inf which does not work on CPU
// [CMPLRLLVM-51856]
if (array1[i] == std::numeric_limits<_DataType1>::infinity()) {
partial &= (array1[i] == array2[i]);
continue;
}
else if (array1[i] ==
-std::numeric_limits<_DataType1>::infinity()) {
partial &= (array1[i] == array2[i]);
continue;
}
else if (array2[i] ==
std::numeric_limits<_DataType2>::infinity()) {
partial &= (array1[i] == array2[i]);
continue;
}
else if (array2[i] ==
-std::numeric_limits<_DataType2>::infinity()) {
partial &= (array1[i] == array2[i]);
continue;
}
}

// casting integeral to floating type to avoid bad behavior
Expand Down
6 changes: 0 additions & 6 deletions tests/skipped_tests.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ tests/test_linalg.py::test_norm1[None-3-[7]]
tests/test_linalg.py::test_norm1[None-3-[1, 2]]
tests/test_linalg.py::test_norm1[None-3-[1, 0]]

tests/test_logic.py::test_allclose[int32]
tests/test_logic.py::test_allclose[int64]
tests/test_logic.py::test_allclose[float32]
tests/test_logic.py::test_allclose[float64]
tests/test_logic.py::test_allclose[None]

tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([[i, i] for i in x])]
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp.asarray([(i, i) for i in x], [("a", int), ("b", int)]).view(dpnp.recarray))]
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]]
Expand Down