From 41831bee8b5b11ebd22c1392a981d41fbc442f39 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Tue, 24 Sep 2024 15:29:08 +0200 Subject: [PATCH 1/2] Update cupy tests for dpnp.linalg.solve() --- .../third_party/cupy/linalg_tests/test_solve.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/third_party/cupy/linalg_tests/test_solve.py b/tests/third_party/cupy/linalg_tests/test_solve.py index dd15e8303af9..d7204f7d4c14 100644 --- a/tests/third_party/cupy/linalg_tests/test_solve.py +++ b/tests/third_party/cupy/linalg_tests/test_solve.py @@ -50,14 +50,20 @@ def check_x(self, a_shape, b_shape, xp, dtype): def test_solve(self): self.check_x((4, 4), (4,)) self.check_x((5, 5), (5, 2)) - self.check_x((2, 4, 4), (2, 4)) self.check_x((2, 5, 5), (2, 5, 2)) - self.check_x((2, 3, 2, 2), (2, 3, 2)) self.check_x((2, 3, 3, 3), (2, 3, 3, 2)) self.check_x((0, 0), (0,)) self.check_x((0, 0), (0, 2)) - self.check_x((0, 2, 2), (0, 2)) self.check_x((0, 2, 2), (0, 2, 3)) + # In numpy 2.0 the broadcast ambiguity has been removed and now + # b is treaded as a single vector if and only if it is 1-dimensional; + # for other cases this signature must be followed + # (..., m, m), (..., m, n) -> (..., m, n) + # https://github.com/numpy/numpy/pull/25914 + if numpy.lib.NumpyVersion(numpy.__version__) < "2.0.0": + self.check_x((2, 4, 4), (2, 4)) + self.check_x((2, 3, 2, 2), (2, 3, 2)) + self.check_x((0, 2, 2), (0, 2)) def check_shape(self, a_shape, b_shape, error_types): for xp, error_type in error_types.items(): @@ -90,7 +96,9 @@ def test_invalid_shape(self): self.check_shape((3, 3), (2,), value_errors) self.check_shape((3, 3), (2, 2), value_errors) self.check_shape((3, 3, 4), (3,), linalg_errors) - self.check_shape((2, 3, 3), (3,), value_errors) + # Since numpy >= 2.0, this case does not raise an error + if numpy.lib.NumpyVersion(numpy.__version__) < "2.0.0": + self.check_shape((2, 3, 3), (3,), value_errors) self.check_shape((3, 3), (0,), value_errors) self.check_shape((0, 3, 4), (3,), linalg_errors) From 3ce72fec2021d885d1fbd845b7d2a3802388a63f Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Thu, 26 Sep 2024 11:17:27 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 729ed3845219..91245b87f937 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,7 @@ In addition, this release completes implementation of `dpnp.fft` module and adds * Use `dpctl::tensor::alloc_utils::sycl_free_noexcept` instead of `sycl::free` in `host_task` tasks associated with life-time management of temporary USM allocations [#2058](https://github.com/IntelPython/dpnp/pull/2058) * Improved implementation of `dpnp.kron` to avoid unnecessary copy for non-contiguous arrays [#2059](https://github.com/IntelPython/dpnp/pull/2059) * Updated the test suit for `dpnp.fft` module [#2071](https://github.com/IntelPython/dpnp/pull/2071) +* Skipped outdated tests for `dpnp.linalg.solve` due to compatibility issues with NumPy 2.0 [#2074](https://github.com/IntelPython/dpnp/pull/2074) ### Fixed