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

fix(depreciation): np >= 1.20 dtype long is int_ #11625

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

Conversation

AwePhD
Copy link
Contributor

@AwePhD AwePhD commented Apr 9, 2024

Motivation

When I was trying to run a small notebook to explore the Obj365 dataset I get an error of a numpy depreciation. Since numpy 1.20, the use of np.long is deprecated. https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

So I run the following command to get the occurrence of the use of np.long in the repo.

$ fgrep -r -n np.long mmdet tools tests configs
mmdet/datasets/transforms/text_transformers.py:63:        keep_gt_labels, dtype=np.long), length
tests/test_models/test_dense_heads/test_lad_head.py:28:                components = np.zeros_like(loss, dtype=np.long)
tests/test_models/test_dense_heads/test_paa_head.py:28:                components = np.zeros_like(loss, dtype=np.long)

Modification

This minor commit just rename the np.long to np.int_.

BC-breaking (Optional)

I do not know what is the impact on this change on numpy versions before. My dev env is based on Python 3.10 so it is not compatible with numpy version <= 1.21.1. Although, only concerning this change, I tested on another dev env of mine and there is no problem to use np.int_, it is a correct data type for Numpy.

Maybe pin the version of numpy prior 1.20.0 in the requirements/build.txt if you do not want to use this commit? So there would not be any depreciation.

@CLAassistant
Copy link

CLAassistant commented Apr 9, 2024

CLA assistant check
All committers have signed the CLA.

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.

3 participants