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

Replace np.float with np.float64. #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

m43
Copy link

@m43 m43 commented May 25, 2023

Describe your changes

Replacing np.float with np.float64 to support numpy>=1.24.0. The np.float,
np.int, etc. aliases were deprecated in NumPy 1.20 (see the deprecation note),
and deprecation has expired with NumPy 1.24 (Nov 24, 2022).

Using the current Pyhon API with newer Numpy versions will therefore raise the
following error:

Traceback (most recent call last):
  ...
  File ".../lib/python3.8/site-packages/pycocotools/ytvoseval.py", line 407, in accumulate
    tp_sum = np.cumsum(tps, axis=1).astype(dtype=np.float)
  File ".../lib/python3.8/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy
scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Checklist before requesting a review

  • I have performed a self-review of my code

Tests

Works on my machine

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.

1 participant