aesara-devs / aesara

Aesara is a Python library for defining, optimizing, and efficiently evaluating mathematical expressions involving multi-dimensional arrays.
https://aesara.readthedocs.io
Other
1.17k stars 156 forks source link

Use NumPy recommended approach to out-of-bounds integer conversion #1496

Closed brandonwillard closed 1 year ago

brandonwillard commented 1 year ago

This PR fixes new deprecation errors caused by certain types of conversions to out-of-bounds integers to integer arrays.

The error is as follows:

DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays.  The conversion of 255 to int8 will fail in the future.
For the old behavior, usually:
    np.array(value).astype(dtype)`
will give the desired result (the cast overflows).
codecov[bot] commented 1 year ago

Codecov Report

Merging #1496 (526b185) into main (ad7a8b7) will decrease coverage by 0.03%. The diff coverage is 100.00%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/aesara-devs/aesara/pull/1496/graphs/tree.svg?width=650&height=150&src=pr&token=2HNzVWyxrA&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs)](https://app.codecov.io/gh/aesara-devs/aesara/pull/1496?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs) ```diff @@ Coverage Diff @@ ## main #1496 +/- ## ========================================== - Coverage 75.09% 75.06% -0.03% ========================================== Files 194 176 -18 Lines 50151 49447 -704 Branches 12108 11968 -140 ========================================== - Hits 37660 37118 -542 + Misses 10170 10036 -134 + Partials 2321 2293 -28 ``` | [Impacted Files](https://app.codecov.io/gh/aesara-devs/aesara/pull/1496?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs) | Coverage Δ | | |---|---|---| | [aesara/misc/safe\_asarray.py](https://app.codecov.io/gh/aesara-devs/aesara/pull/1496?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs#diff-YWVzYXJhL21pc2Mvc2FmZV9hc2FycmF5LnB5) | `69.23% <100.00%> (ø)` | | ... and [19 files with indirect coverage changes](https://app.codecov.io/gh/aesara-devs/aesara/pull/1496/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aesara-devs)