torch-toolbox icon indicating copy to clipboard operation
torch-toolbox copied to clipboard

`np.int` now deprecated

Open dhairyag opened this issue 10 months ago • 2 comments

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
    ```
    

dhairyag avatar Apr 12 '24 08:04 dhairyag

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

chouheiwa avatar May 13 '24 13:05 chouheiwa

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

I already merged the pr.

PistonY avatar May 13 '24 15:05 PistonY