-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
use torch.nn.functional.one_hot rewrite convert_to_one_hot #696
Conversation
Thank you for your contribution, please fix the lint refer to this guide before we review it. |
After installing try to run
twice in '$MMClassification' to check if there is any style error and fix it. |
cannot understand this error:
|
Codecov Report
@@ Coverage Diff @@
## dev #696 +/- ##
=======================================
Coverage 85.03% 85.03%
=======================================
Files 121 121
Lines 7389 7392 +3
Branches 1277 1278 +1
=======================================
+ Hits 6283 6286 +3
Misses 916 916
Partials 190 190
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
That means the pre-commit would modify the code automatically. you can let the L117 in one line:
and run
|
doesn't seem like a necessary change, currently I cannot install&use pre-commit successfully for some permission problem, so is there a work-around? |
OK, get it. We would modify it later when reviewing. |
that's great help |
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.
LGTM.
…_hot`. (open-mmlab#696) * some change to mmcls/models/losses/utils.py:convert_to_one_hot() * fixed problem: line too long * fixed wrong output shape * fixed lint PEP8 E128 * fix lint * fix lint * add unit tests Co-authored-by: Ezra-Yu <[email protected]>
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
Torch has the implementation of one-hot, here we can replace the one-hot implemented by MMCLS itself
Modification
as described above
BC-breaking (Optional)
Does the modification introduce changes that break the backward compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.
Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases here and update the documentation.
Checklist
Before PR:
After PR: