Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cupy tests for dpnp.linalg.solve() #2074

Merged
merged 3 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,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
Loading