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

np.int now deprecated #21

Open
dhairyag opened this issue Apr 12, 2024 · 2 comments
Open

np.int now deprecated #21

dhairyag opened this issue Apr 12, 2024 · 2 comments

Comments

@dhairyag
Copy link

https://github.com/PistonY/torch-toolbox/blame/993a0dfe56de9eda8d12aa08ebdae6ee932545cf/torchtoolbox/transform/autoaugment.py#L104

For the above line, following error is encountered

/usr/local/lib/python3.10/dist-packages/torchtoolbox/transform/autoaugment.py in __init__(self, p, magnitude)
    102 class Posterize(SubPolicy):
    103     def __init__(self, p, magnitude=None):
--> 104         ranges = np.round(np.linspace(8, 4, 10), 0).astype(np.int)
    105         super(Posterize, self).__init__(p, magnitude, ranges)
    106 

/usr/local/lib/python3.10/dist-packages/numpy/__init__.py in __getattr__(attr)
    317 
    318         if attr in __former_attrs__:
--> 319             raise AttributeError(__former_attrs__[attr])
    320 
    321         if attr == 'testing':

AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
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
    ```
    
@chouheiwa
Copy link
Contributor

@dhairyag Hello, for short term fix, you can use pip install git+https://github.com/chouheiwa/torch-toolbox.git.

@PistonY
Copy link
Owner

PistonY commented May 13, 2024

@dhairyag Hello, for short term fix, you can use pip install git+https://github.com/chouheiwa/torch-toolbox.git.

I already merged the pr.

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

No branches or pull requests

3 participants