Skip to content

Commit fd343be

Browse files
authored
Merge branch 'master' into compare-shape
2 parents ef6df2f + 4c5970b commit fd343be

File tree

5 files changed

+43
-44
lines changed

5 files changed

+43
-44
lines changed

.github/workflows/openssf-scorecard.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ jobs:
6868

6969
# Upload the results to GitHub's code scanning dashboard.
7070
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@1b549b9259bda1cb5ddde3b41741a82a2d15a841 # v3.28.13
71+
uses: github/codeql-action/upload-sarif@45775bd8235c68ba998cffa5171334d58593da47 # v3.28.15
7272
with:
7373
sarif_file: results.sarif

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ This release achieves 100% compliance with Python Array API specification (revis
2626
* Updated `dpnp.fix` to return output with the same data-type of input [#2392](https://github.com/IntelPython/dpnp/pull/2392)
2727
* Updated `dpnp.einsum` to add support for `order=None` [#2411](https://github.com/IntelPython/dpnp/pull/2411)
2828
* Updated Python Array API specification version supported to `2024.12` [#2416](https://github.com/IntelPython/dpnp/pull/2416)
29+
* Removed `einsum_call` keyword from `dpnp.einsum_path` signature [#2421](https://github.com/IntelPython/dpnp/pull/2421)
2930

3031
### Fixed
3132

3233
* Resolved an issue with an incorrect result returned due to missing dependency from the strided kernel on a copy event in `dpnp.erf` [#2378](https://github.com/IntelPython/dpnp/pull/2378)
3334
* Updated `conda create` commands build and install instructions of `Quick start guide` to avoid a compilation error [#2395](https://github.com/IntelPython/dpnp/pull/2395)
35+
* Added handling of empty string passed to a test env variable defining data type scope as a `False` value [#2415](https://github.com/IntelPython/dpnp/pull/2415)
3436

3537

3638
## [0.17.0] - 02/26/2025

dpnp/dpnp_iface_linearalgebra.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def einsum(
472472
)
473473

474474

475-
def einsum_path(*operands, optimize="greedy", einsum_call=False):
475+
def einsum_path(*operands, optimize="greedy"):
476476
"""
477477
einsum_path(subscripts, *operands, optimize="greedy")
478478
@@ -498,7 +498,7 @@ def einsum_path(*operands, optimize="greedy", einsum_call=False):
498498
* if a list is given that starts with ``einsum_path``, uses this as the
499499
contraction path
500500
* if ``False`` or ``None`` no optimization is taken
501-
* if ``True`` defaults to the "greedy" algorithm
501+
* if ``True`` defaults to the ``"greedy"`` algorithm
502502
* ``"optimal"`` is an algorithm that combinatorially explores all
503503
possible ways of contracting the listed tensors and chooses the
504504
least costly path. Scales exponentially with the number of terms
@@ -601,7 +601,7 @@ def einsum_path(*operands, optimize="greedy", einsum_call=False):
601601
return numpy.einsum_path(
602602
*operands,
603603
optimize=optimize,
604-
einsum_call=einsum_call,
604+
einsum_call=False,
605605
)
606606

607607

dpnp/tests/config.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
all_int_types = int(os.getenv("DPNP_TEST_ALL_INT_TYPES", 0))
4-
float16_types = int(os.getenv("DPNP_TEST_FLOAT_16", 0))
5-
complex_types = int(os.getenv("DPNP_TEST_COMPLEX_TYPES", 0))
6-
bool_types = int(os.getenv("DPNP_TEST_BOOL_TYPES", 0))
3+
all_int_types = bool(os.getenv("DPNP_TEST_ALL_INT_TYPES", 0))
4+
float16_types = bool(os.getenv("DPNP_TEST_FLOAT_16", 0))
5+
complex_types = bool(os.getenv("DPNP_TEST_COMPLEX_TYPES", 0))
6+
bool_types = bool(os.getenv("DPNP_TEST_BOOL_TYPES", 0))

dpnp/tests/test_ndarray.py

+33-36
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():

0 commit comments

Comments
 (0)