Skip to content

Commit

Permalink
Update cupy tests for dpnp.linalg.solve() (#2074)
Browse files Browse the repository at this point in the history
* Update cupy tests for dpnp.linalg.solve()

* Update CHANGELOG.md
  • Loading branch information
vlad-perevezentsev committed Sep 27, 2024
1 parent bd6546e commit 7b3c48c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ In addition, this release completes implementation of `dpnp.fft` module and adds
* 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)
* Reworked `dpnp.clip` implementation to align with Python Array API 2023.12 specification [#2048](https://github.com/IntelPython/dpnp/pull/2048)
* Skipped outdated tests for `dpnp.linalg.solve` due to compatibility issues with NumPy 2.0 [#2074](https://github.com/IntelPython/dpnp/pull/2074)

### Fixed

Expand Down
16 changes: 12 additions & 4 deletions tests/third_party/cupy/linalg_tests/test_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 7b3c48c

Please sign in to comment.