Skip to content

np.int now deprecated #21

@dhairyashilRG

Description

@dhairyashilRG

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions