Skip to content

Commit 92d27d8

Browse files
Merge master into impl_of_interp
2 parents 36ee455 + eb05183 commit 92d27d8

File tree

9 files changed

+165
-104
lines changed

9 files changed

+165
-104
lines changed

.github/workflows/array-api-skips.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# array API tests to be skipped
22

3-
# hypothesis found failures
4-
array_api_tests/test_operators_and_elementwise_functions.py::test_clip
5-
63
# unexpected result is returned - unmute when dpctl-1986 is resolved
74
array_api_tests/test_operators_and_elementwise_functions.py::test_asin
85
array_api_tests/test_operators_and_elementwise_functions.py::test_asinh

.github/workflows/check-mkl-interfaces.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
fetch-depth: 0
8484

8585
- name: Download artifact
86-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
86+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
8787
with:
8888
name: ${{ env.environment-file-name }}
8989
path: ${{ env.environment-file-loc }}
@@ -176,7 +176,7 @@ jobs:
176176
fetch-depth: 0
177177

178178
- name: Download artifact
179-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
179+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
180180
with:
181181
name: ${{ env.environment-file-name }}
182182
path: ${{ env.environment-file-loc }}

.github/workflows/conda-package.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ jobs:
149149
path: ${{ env.dpnp-repo-path }}
150150

151151
- name: Download artifact
152-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
152+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
153153
with:
154154
name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }}
155155
path: ${{ env.pkg-path-in-channel }}
@@ -281,7 +281,7 @@ jobs:
281281
path: ${{ env.dpnp-repo-path }}
282282

283283
- name: Download artifact
284-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
284+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
285285
with:
286286
name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }}
287287
path: ${{ env.pkg-path-in-channel }}
@@ -445,12 +445,12 @@ jobs:
445445
fetch-depth: ${{ env.fetch-depth }}
446446

447447
- name: Download artifact
448-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
448+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
449449
with:
450450
name: ${{ env.package-name }} ${{ runner.os }} Python ${{ matrix.python }}
451451

452452
- name: Download wheels artifact
453-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
453+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
454454
with:
455455
name: ${{ env.package-name }} ${{ runner.os }} Wheels Python ${{ matrix.python }}
456456

@@ -533,7 +533,7 @@ jobs:
533533
path: ${{ env.dpnp-repo-path }}
534534

535535
- name: Download artifact
536-
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
536+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
537537
with:
538538
name: ${{ env.package-name }} ${{ runner.os }} Python ${{ env.python-ver }}
539539
path: ${{ env.pkg-path-in-channel }}

.github/workflows/pre-commit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3030

3131
- name: Set up python
32-
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
32+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
3333
with:
3434
python-version: '3.13'
3535

dpnp/tests/test_ndarray.py

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class TestAsType:
2424
@pytest.mark.usefixtures("suppress_complex_warning")
2525
@pytest.mark.parametrize("res_dtype", get_all_dtypes())
26-
@pytest.mark.parametrize("arr_dtype", get_all_dtypes())
26+
@pytest.mark.parametrize("arr_dtype", get_all_dtypes(no_none=True))
2727
@pytest.mark.parametrize(
2828
"arr",
2929
[[-2, -1, 0, 1, 2], [[-2, -1], [1, 2]], []],
@@ -35,7 +35,7 @@ def test_basic(self, arr, arr_dtype, res_dtype):
3535

3636
expected = a.astype(res_dtype)
3737
result = ia.astype(res_dtype)
38-
assert_allclose(expected, result)
38+
assert_allclose(result, expected)
3939

4040
def test_subok_error(self):
4141
x = dpnp.ones(4)
@@ -88,18 +88,18 @@ def test_create_from_usm_ndarray_error(arr):
8888
dpnp.ndarray._create_from_usm_ndarray(arr)
8989

9090

91-
@pytest.mark.parametrize("arr_dtype", get_all_dtypes())
91+
@pytest.mark.parametrize("arr_dtype", get_all_dtypes(no_none=True))
9292
@pytest.mark.parametrize(
9393
"arr",
9494
[[-2, -1, 0, 1, 2], [[-2, -1], [1, 2]], []],
9595
ids=["[-2, -1, 0, 1, 2]", "[[-2, -1], [1, 2]]", "[]"],
9696
)
9797
def test_flatten(arr, arr_dtype):
98-
numpy_array = get_abs_array(arr, arr_dtype)
99-
dpnp_array = dpnp.array(numpy_array)
100-
expected = numpy_array.flatten()
101-
result = dpnp_array.flatten()
102-
assert_array_equal(expected, result)
98+
a = get_abs_array(arr, arr_dtype)
99+
ia = dpnp.array(a)
100+
expected = a.flatten()
101+
result = ia.flatten()
102+
assert_array_equal(result, expected)
103103

104104

105105
@pytest.mark.parametrize(
@@ -110,17 +110,16 @@ def test_flatten(arr, arr_dtype):
110110
@pytest.mark.parametrize("order", ["C", "F"])
111111
def test_flags(shape, order):
112112
usm_array = dpt.usm_ndarray(shape, order=order)
113-
numpy_array = numpy.ndarray(shape, order=order)
114-
dpnp_array = dpnp.ndarray(shape, order=order)
115-
assert usm_array.flags == dpnp_array.flags
116-
assert numpy_array.flags.c_contiguous == dpnp_array.flags.c_contiguous
117-
assert numpy_array.flags.f_contiguous == dpnp_array.flags.f_contiguous
113+
a = numpy.ndarray(shape, order=order)
114+
ia = dpnp.ndarray(shape, order=order)
115+
assert usm_array.flags == ia.flags
116+
assert a.flags.c_contiguous == ia.flags.c_contiguous
117+
assert a.flags.f_contiguous == ia.flags.f_contiguous
118118

119119

120120
@pytest.mark.parametrize(
121121
"dtype",
122122
[numpy.complex64, numpy.float32, numpy.int64, numpy.int32, numpy.bool_],
123-
ids=["complex64", "float32", "int64", "int32", "bool"],
124123
)
125124
@pytest.mark.parametrize("strides", [(1, 4), (4, 1)], ids=["(1, 4)", "(4, 1)"])
126125
@pytest.mark.parametrize("order", ["C", "F"])
@@ -130,13 +129,11 @@ def test_flags_strides(dtype, order, strides):
130129
usm_array = dpt.usm_ndarray(
131130
(4, 4), dtype=dtype, order=order, strides=strides
132131
)
133-
numpy_array = numpy.ndarray(
134-
(4, 4), dtype=dtype, order=order, strides=numpy_strides
135-
)
136-
dpnp_array = dpnp.ndarray((4, 4), dtype=dtype, order=order, strides=strides)
137-
assert usm_array.flags == dpnp_array.flags
138-
assert numpy_array.flags.c_contiguous == dpnp_array.flags.c_contiguous
139-
assert numpy_array.flags.f_contiguous == dpnp_array.flags.f_contiguous
132+
a = numpy.ndarray((4, 4), dtype=dtype, order=order, strides=numpy_strides)
133+
ia = dpnp.ndarray((4, 4), dtype=dtype, order=order, strides=strides)
134+
assert usm_array.flags == ia.flags
135+
assert a.flags.c_contiguous == ia.flags.c_contiguous
136+
assert a.flags.f_contiguous == ia.flags.f_contiguous
140137

141138

142139
def test_flags_writable():
@@ -383,9 +380,9 @@ def test_print_dpnp_zero_shape():
383380
"dtype", get_all_dtypes(no_float16=False, no_complex=True)
384381
)
385382
def test_scalar_type_casting(func, shape, dtype):
386-
numpy_array = numpy.full(shape, 5, dtype=dtype)
387-
dpnp_array = dpnp.full(shape, 5, dtype=dtype)
388-
assert func(numpy_array) == func(dpnp_array)
383+
a = numpy.full(shape, 5, dtype=dtype)
384+
ia = dpnp.full(shape, 5, dtype=dtype)
385+
assert func(a) == func(ia)
389386

390387

391388
# Numpy will raise an error when converting a.ndim > 0 to a scalar
@@ -396,12 +393,12 @@ def test_scalar_type_casting(func, shape, dtype):
396393
)
397394
@pytest.mark.parametrize("shape", [tuple(), (1,), (1, 1), (1, 1, 1)])
398395
@pytest.mark.parametrize(
399-
"dtype", get_all_dtypes(no_float16=False, no_complex=True, no_none=True)
396+
"dtype", get_all_dtypes(no_float16=False, no_complex=True)
400397
)
401398
def test_scalar_type_casting_by_method(method, shape, dtype):
402-
numpy_array = numpy.full(shape, 4.7, dtype=dtype)
403-
dpnp_array = dpnp.full(shape, 4.7, dtype=dtype)
404-
assert getattr(numpy_array, method)() == getattr(dpnp_array, method)()
399+
a = numpy.full(shape, 4.7, dtype=dtype)
400+
ia = dpnp.full(shape, 4.7, dtype=dtype)
401+
assert_allclose(getattr(a, method)(), getattr(ia, method)(), rtol=1e-06)
405402

406403

407404
@pytest.mark.parametrize("shape", [(1,), (1, 1), (1, 1, 1)])
@@ -452,18 +449,18 @@ def test_ravel():
452449

453450

454451
def test_repeat():
455-
numpy_array = numpy.arange(4).repeat(3)
456-
dpnp_array = dpnp.arange(4).repeat(3)
457-
assert_array_equal(numpy_array, dpnp_array)
452+
a = numpy.arange(4).repeat(3)
453+
ia = dpnp.arange(4).repeat(3)
454+
assert_array_equal(a, ia)
458455

459456

460457
def test_clip():
461-
numpy_array = numpy.arange(10)
462-
dpnp_array = dpnp.arange(10)
463-
result = dpnp.clip(dpnp_array, 3, 7)
464-
expected = numpy.clip(numpy_array, 3, 7)
458+
a = numpy.arange(10)
459+
ia = dpnp.arange(10)
460+
result = dpnp.clip(ia, 3, 7)
461+
expected = numpy.clip(a, 3, 7)
465462

466-
assert_array_equal(expected, result)
463+
assert_array_equal(result, expected)
467464

468465

469466
def test_rmatmul_dpnp_array():

dpnp/tests/test_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def test_ones(self, dtype):
199199
@pytest.mark.parametrize("dtype", get_all_dtypes(no_bool=True))
200200
def test_arange(self, dtype):
201201
n = 10**2
202-
m = 10**3 if dtype is not dpnp.float32 else 10**2
202+
m = 10**3 if dtype not in [dpnp.float32, dpnp.complex64] else 10**2
203203
a = numpy.hstack((numpy.arange(n, dtype=dtype),) * m)
204204
b = numpy.flipud(a)
205205
ia = dpnp.array(a)

0 commit comments

Comments
 (0)