Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The upcoming numpy v2.0.0 release introduces a few breaking changes for autograd. This PR fixes these issues:
msort
was removed from the numpy API. I added conditional imports. The corresponding VJPs are now only defined if the numpy version is <2.np.array(value, copy=False)
was removed. The same effect can now be achieved vianp.asarray(value)
.np.solve
changed.np.linalg.linalg
was renamed tonp.linalg._linalg
.One thing that I did not adress in this PR is the changing behavior for
np.sign
with complex arguments. Instead of the sign of the real part, numpy now returnsz /|z|
.On my machine all tests pass with the latest release versions (numpy==1.26.4 scipy==1.12.0) and the current release candidates (numpy==2.0.0.rc1 scipy==1.13.0rc1) but for
tests/test_systematic.py::test_sign
which fails for numpy v2 withbecause of the aforementioned changes to the behavior of the sign function.