Skip to content

Commit

Permalink
Add complex type in dpnp.copy() and tune tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antonwolfy committed May 22, 2023
1 parent 5e1d133 commit bd8be5b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/conda-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
test_linalg.py
test_mathematical.py
test_random_state.py
test_sort.py
test_special.py
test_usm_type.py
VER_JSON_NAME: 'version.json'
Expand Down
4 changes: 2 additions & 2 deletions dpnp/backend/kernels/dpnp_krnl_elemwise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,8 @@ static void func_map_init_elemwise_1arg_1type(func_map_t& fmap)
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_copy_c_ext<int64_t>};
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_FLT][eft_FLT] = {eft_FLT, (void*)dpnp_copy_c_ext<float>};
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_DBL][eft_DBL] = {eft_DBL, (void*)dpnp_copy_c_ext<double>};
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_C128][eft_C128] = {eft_C128,
(void*)dpnp_copy_c_ext<std::complex<double>>};
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_C64][eft_C64] = {eft_C64, (void*)dpnp_copy_c_ext<std::complex<float>>};
fmap[DPNPFuncName::DPNP_FN_COPY_EXT][eft_C128][eft_C128] = {eft_C128, (void*)dpnp_copy_c_ext<std::complex<double>>};

fmap[DPNPFuncName::DPNP_FN_ERF][eft_INT][eft_INT] = {eft_INT, (void*)dpnp_erf_c_default<int32_t>};
fmap[DPNPFuncName::DPNP_FN_ERF][eft_LNG][eft_LNG] = {eft_LNG, (void*)dpnp_erf_c_default<int64_t>};
Expand Down
2 changes: 0 additions & 2 deletions tests/skipped_tests.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]]
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray(x).astype(dpnp.int8)]

tests/test_sort.py::test_partition[[[1, 0], [3, 0]]-float32-1]

tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py::TestAngle::test_angle
tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py::TestRealImag::test_imag
tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py::TestRealImag::test_imag_inplace
Expand Down
1 change: 0 additions & 1 deletion tests/skipped_tests_gpu.tbl
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ tests/test_linalg.py::test_matrix_rank[None-[[1, 2], [3, 4]]-int32]
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)])]]
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray(x).astype(dpnp.int8)]
tests/test_sort.py::test_partition[[[1, 0], [3, 0]]-float32-1]

tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py::TestAngle::test_angle
tests/third_party/cupy/core_tests/test_ndarray_complex_ops.py::TestRealImag::test_imag
Expand Down
7 changes: 5 additions & 2 deletions tests/test_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ def test_partition(array, dtype, kth):
a = dpnp.array(array, dtype)
p = dpnp.partition(a, kth)

assert (p[0:kth] <= p[kth]).all()
assert (p[kth] <= p[kth + 1:]).all()
# TODO: remove once dpnp.less_equal() support complex types
p = p.asnumpy()

assert (p[..., 0:kth] <= p[..., kth:kth + 1]).all()
assert (p[..., kth:kth + 1] <= p[..., kth + 1:]).all()


@pytest.mark.usefixtures("allow_fall_back_on_numpy")
Expand Down

0 comments on commit bd8be5b

Please sign in to comment.