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

Deprecating np.bool Type Alias #9498

Merged
merged 2 commits into from Dec 22, 2022
Merged

Deprecating np.bool Type Alias #9498

merged 2 commits into from Dec 22, 2022

Conversation

zachcoleman
Copy link

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily get feedback. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

Gets rid of instances of np.bool to increase compatibility with newer versions of numpy. For more details see: https://numpy.org/doc/stable/release/1.20.0-notes.html#deprecations.

Note: np.bool has just been an alias for bool

Modification

Replaces all np.bool instances w/ bool.

BC-breaking (Optional)

Not applicable

Use cases (Optional)

Not applicable

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit test to ensure the correctness.
  3. If the modification has potential influence on downstream projects, this PR should be tested with downstream projects, like MMDet or MMCls.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@CLAassistant
Copy link

CLAassistant commented Dec 15, 2022

CLA assistant check
All committers have signed the CLA.

@hhaAndroid
Copy link
Collaborator

@zachcoleman Hi, I would like to ask if there is a problem if the user version is lower than 1.20?

@ZwwWayne ZwwWayne changed the base branch from master to dev December 19, 2022 03:27
@ZwwWayne ZwwWayne added this to the 2.27.0 milestone Dec 19, 2022
@ZwwWayne ZwwWayne assigned hhaAndroid and unassigned RangiLyu Dec 19, 2022
@zachcoleman
Copy link
Author

Details

@hhaAndroid There should be no problem. np.bool is just an alias and another variable pointing to bool. As an example here's numpy v1.19.5:

and another version v1.16.6 (this version is ~3 years old):

I believe using bool is the most compatible way to define these arrays across versions. There is work for 1.25.0 (scheduled for June 2023) to add np.bool back into numpy.

I will follow up when I get an answer here to try and determine the best course forward. My instinct is that bool is probably the best way to do this for <1.20, 1.20-1.24, and 1.25+ based on the logic to map bool accordingly (see here).

@ZwwWayne ZwwWayne merged commit 604be70 into open-mmlab:dev Dec 22, 2022
@openmmlab-bot
Copy link
Collaborator

Dear zachcoleman,
First of all, we want to express our gratitude for your significant PR in the MMDet project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR.
We are looking forward to continuing our collaboration with you. OpenMMLab has established a special contributors' organization called MMSIG, which provides contributors with open-source certificates, a recognition system, and exclusive rewards. You can contact us by adding our WeChat(if you have WeChat): openmmlabwx, or join in our discord:https://discord.gg/raweFPmdzG. We sincerely hope you will join us!
Best regards! @zachcoleman

thmegy pushed a commit to thmegy/mmdetection that referenced this pull request May 5, 2023
* deprecating np.bool type alias

* updating the flake8 version to fix flake8 bug
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.

None yet

6 participants