PistonY / torch-toolbox

🛠 Toolbox to extend PyTorch functionalities
BSD 3-Clause "New" or "Revised" License
416 stars 56 forks source link

`np.int` now deprecated #21

Open dhairyag opened 2 months ago

dhairyag commented 2 months ago

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 commented 1 month ago

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

PistonY commented 1 month ago

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

I already merged the pr.