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 dpnp.linalg.solve() to align NumPy 2.0 #2198

Merged
merged 14 commits into from
Nov 28, 2024

Conversation

vlad-perevezentsev
Copy link
Collaborator

@vlad-perevezentsev vlad-perevezentsev commented Nov 26, 2024

This PR proposes to update dpnp.linalg.solve() implementation to align with NumPy >= 2.0 and also Python array API standard .

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)

This is accomplished by using dpnp.broadcast_to() for input arrays in the current suggestion.

Running array api tests for dpnp.linalg.solve() with NumPy 2.1

$ pytest -v array_api_tests/test_linalg.py::test_solve
========================== 1 passed, 1 warning in 0.35s ===================================

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • If this PR is a work in progress, are you filing the PR as a draft?

Copy link
Contributor

github-actions bot commented Nov 26, 2024

View rendered docs @ https://intelpython.github.io/dpnp/index.html

Copy link
Contributor

@antonwolfy antonwolfy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vlad-perevezentsev vlad-perevezentsev merged commit 4e02172 into master Nov 28, 2024
48 checks passed
@vlad-perevezentsev vlad-perevezentsev deleted the update_solve_numpy_2_0 branch November 28, 2024 12:13
github-actions bot added a commit that referenced this pull request Nov 28, 2024
* Update solve with broadcasting to align numpy 2.0

* Update and add more tests for solve()

* Keep only solve() logic for numpy 2.0 compatibility

* Update cupy tests for solve()

* Align TestSolve with cupy tests

* Cover case b.ndim==0

* Add notes for solve() 4e02172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants