|
2 | 2 |
|
3 | 3 | import numpy
|
4 | 4 | import pytest
|
| 5 | +import scipy |
5 | 6 | from numpy.testing import assert_array_equal
|
6 | 7 |
|
7 | 8 | import dpnp
|
|
12 | 13 | get_all_dtypes,
|
13 | 14 | get_complex_dtypes,
|
14 | 15 | get_float_complex_dtypes,
|
| 16 | + get_float_dtypes, |
15 | 17 | get_integer_dtypes,
|
16 | 18 | get_integer_float_dtypes,
|
17 | 19 | numpy_version,
|
@@ -164,21 +166,14 @@ def test_reduce_hypot(dtype, stride):
|
164 | 166 | assert_dtype_allclose(result, expected, check_only_type_kind=flag)
|
165 | 167 |
|
166 | 168 |
|
167 |
| -@pytest.mark.parametrize( |
168 |
| - "dtype", |
169 |
| - get_integer_float_dtypes( |
170 |
| - no_unsigned=True, xfail_dtypes=[dpnp.int8, dpnp.int16] |
171 |
| - ), |
172 |
| -) |
173 |
| -def test_erf(dtype): |
174 |
| - a = dpnp.linspace(-1, 1, num=10, dtype=dtype) |
175 |
| - b = a[::2] |
176 |
| - result = dpnp.erf(b) |
177 |
| - |
178 |
| - expected = numpy.empty_like(b.asnumpy()) |
179 |
| - for idx, val in enumerate(b): |
180 |
| - expected[idx] = math.erf(val) |
| 169 | +@pytest.mark.parametrize("dtype", get_float_dtypes(no_float16=False)) |
| 170 | +@pytest.mark.parametrize("stride", [2, -1, -3]) |
| 171 | +def test_erf(dtype, stride): |
| 172 | + x = generate_random_numpy_array(10, dtype=dtype) |
| 173 | + a, ia = x[::stride], dpnp.array(x)[::stride] |
181 | 174 |
|
| 175 | + result = dpnp.special.erf(ia) |
| 176 | + expected = scipy.special.erf(a) |
182 | 177 | assert_dtype_allclose(result, expected)
|
183 | 178 |
|
184 | 179 |
|
|
0 commit comments