Skip to content

Commit 816bd93

Browse files
Update tests for dpnp.power
1 parent e46dd0b commit 816bd93

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

tests/skipped_tests_gpu_no_fp64.tbl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ tests/test_sycl_queue.py::test_array_creation[opencl:gpu:0-arange-arg0-kwargs0]
8080
tests/test_sycl_queue.py::test_array_creation[level_zero:gpu:0-arange-arg0-kwargs0]
8181
tests/test_sycl_queue.py::test_1in_1out[opencl:gpu:0-gradient-data10]
8282
tests/test_sycl_queue.py::test_1in_1out[level_zero:gpu:0-gradient-data10]
83-
tests/test_sycl_queue.py::test_out_2in_1out[opencl:gpu:0-power-data19-data29]
84-
tests/test_sycl_queue.py::test_out_2in_1out[level_zero:gpu:0-power-data19-data29]
8583
tests/test_sycl_queue.py::test_eig[opencl:gpu:0]
8684
tests/test_sycl_queue.py::test_eig[level_zero:gpu:0]
8785
tests/test_sycl_queue.py::test_eigh[opencl:gpu:0]

tests/test_mathematical.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,15 +995,21 @@ def test_out_dtypes(self, dtype):
995995

996996
@pytest.mark.parametrize("dtype", get_all_dtypes(no_bool=True))
997997
def test_out_overlap(self, dtype):
998-
size = 5
998+
size = 10
999+
# DPNP
9991000
dp_a = dpnp.arange(2 * size, dtype=dtype)
1000-
with pytest.raises(TypeError):
1001-
dpnp.power(dp_a[size::], dp_a[::2], out=dp_a[:size:])
1001+
dpnp.power(dp_a[size::], dp_a[::2], out=dp_a[:size:]),
1002+
1003+
# original
1004+
np_a = numpy.arange(2 * size, dtype=dtype)
1005+
numpy.power(np_a[size::], np_a[::2], out=np_a[:size:])
1006+
1007+
rtol = 1e-05 if dtype is dpnp.complex64 else 1e-07
1008+
assert_allclose(np_a, dp_a, rtol=rtol)
10021009

10031010
@pytest.mark.parametrize(
10041011
"dtype", get_all_dtypes(no_bool=True, no_none=True)
10051012
)
1006-
@pytest.mark.skip("mute until in-place support in dpctl is done")
10071013
def test_inplace_strided_out(self, dtype):
10081014
size = 5
10091015

@@ -1023,7 +1029,7 @@ def test_invalid_shape(self, shape):
10231029
dp_array2 = dpnp.arange(5, 15, dtype=dpnp.float32)
10241030
dp_out = dpnp.empty(shape, dtype=dpnp.float32)
10251031

1026-
with pytest.raises(TypeError):
1032+
with pytest.raises(ValueError):
10271033
dpnp.power(dp_array1, dp_array2, out=dp_out)
10281034

10291035
@pytest.mark.parametrize(
@@ -1056,7 +1062,7 @@ def test_complex_values(self):
10561062
def test_integer_power_of_0_or_1(self, val, dtype):
10571063
np_arr = numpy.arange(10, dtype=dtype)
10581064
dp_arr = dpnp.array(np_arr)
1059-
func = lambda x: 1**x
1065+
func = lambda x: val**x
10601066

10611067
assert_equal(func(np_arr), func(dp_arr))
10621068

tests/test_usm_type.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,8 @@ def test_coerced_usm_types_power(usm_type_x, usm_type_y):
9797
y = dp.arange(70, usm_type=usm_type_y).reshape((7, 5, 2))
9898

9999
z = 2**x**y**1.5
100-
101-
# TODO: unmute once dpctl support that
102-
# z **= x
103-
# z **= 1.7
100+
z **= x
101+
z **= 1.7
104102

105103
assert x.usm_type == usm_type_x
106104
assert y.usm_type == usm_type_y

0 commit comments

Comments
 (0)