pennylane
pennylane copied to clipboard
Pennylane is compatible with numpy 2.0
Context:
Want to make Pennylane compatible with Numpy 2.0.
Description of the Change:
- Update repo to use Numpy 2.0.0 and autograd 1.7.0.
- Unpin Numpy version from setup.py
- Update requirements-ci to include scipy 1.13 (this adds support for numpy 2.0)
- Change
np.NaN
tonp.nan
- Use legacy printing representation in tests, contrary to the new numpy representation of scalars, e.g. np.float64(3.0) rather than just 3.0.
- Update probabilities warning to be case insensitive and check for partial match, since this warning was changed in Numpy 2.0
- Check datatype of np.exp from Global phase only for Numpy 1.x, since this gets promoted to complex128 in Numpy 2.x. https://numpy.org/neps/nep-0050-scalar-promotion.html#schema-of-the-new-proposed-promotion-rules
Benefits:
Make Pennylane compatible with Numpy 2.0.0
Possible Drawbacks:
Need to add further steps in the pipeline to ensure Pennylane is compatible with both Numpy 1.x
and Numpy 2.x
[sc-61399] [sc-66548]