-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Hash values in LightningEnum instead of name. #8421
Conversation
Codecov Report
@@ Coverage Diff @@
## master #8421 +/- ##
=======================================
- Coverage 93% 88% -5%
=======================================
Files 217 217
Lines 14225 14225
=======================================
- Hits 13199 12536 -663
- Misses 1026 1689 +663 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this?
You can do so with a doctest for DeviceType
in line 85
>>> # which is case invariant
>>> DeviceType.TPU in ('tpu', 'CPU')
True
+ >>> DeviceType.TPU in {'tpu', 'CPU'}
+ True
Done! Let me know if everything is fine 🙌 |
Oh and one last thing, needs an entry in the "Fixed" section of https://github.com/PyTorchLightning/pytorch-lightning/blob/master/CHANGELOG.md |
Head branch was pushed to by a user without write access
Dear @ramonemiliani93, Weird, enum doesn't play nice with Set. Might be worth to replace it with list and get this merge. Best, |
Co-authored-by: Ethan Harris <[email protected]>
What does this PR do?
Fixes enums hash by name and not by value. For example:
Both should have the same result.
Before submitting
PR review
Anyone in the community is free to review the PR once the tests have passed.
Before you start reviewing make sure you have read Review guidelines. In short, see the following bullet-list:
Did you have fun?
Make sure you had fun coding 🙃