qiboteam / qibo

A full-stack framework for quantum computing.
https://qibo.science
Apache License 2.0
294 stars 60 forks source link

Fix `DeprecationWarning` for `numpy > 1.25` #1395

Closed renatomello closed 3 months ago

renatomello commented 4 months ago

Checklist:

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.99%. Comparing base (c598c67) to head (e085386).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1395 +/- ## ======================================= Coverage 99.99% 99.99% ======================================= Files 78 78 Lines 11191 11192 +1 ======================================= + Hits 11190 11191 +1 Misses 1 1 ``` | [Flag](https://app.codecov.io/gh/qiboteam/qibo/pull/1395/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/qiboteam/qibo/pull/1395/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam) | `99.99% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=qiboteam#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

alecandido commented 4 months ago

At some point, we should also take into account migrating to NumPy 2.0, now that is out.

A much relevant improvement (to us) could be the following: https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-compatible-functions-aliases https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-compatible-functions-for-numpy-linalg https://numpy.org/doc/stable/release/2.0.0-notes.html#array-api-standard-support-in-the-main-namespace

It was already documented for v1, and there are compatibility packages available https://numpy.org/doc/stable/reference/array_api.html but now it is available by default, and it should improve the compatibility with the other array frameworks (i.e. TensorFlow, PyTorch, JAX, CuPy, ...), since the Python API has been standardized (not all of them adopted it already, but they might do it).