-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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 floordiv warning. #8648
Fix floordiv warning. #8648
Conversation
The unit tests of pytorch<=1.7 failed. MMDetection needs to support all versions of pytorch >= 1.6. |
If we add a conditional selection (torch version>=1.8 or torch version <1.8) before calculation, is it ok? |
We can implement a floordiv wrapper that handles different pytorch versions, and use that wrapper uniformly in the head. |
Thanks for your suggestion. I have modify the code and wait for your review. |
Codecov Report
@@ Coverage Diff @@
## dev #8648 +/- ##
=======================================
Coverage 64.07% 64.08%
=======================================
Files 361 361
Lines 29528 29536 +8
Branches 5021 5022 +1
=======================================
+ Hits 18920 18927 +7
- Misses 9591 9592 +1
Partials 1017 1017
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
|
||
|
||
def floordiv(dividend, divisor, rounding_mode='trunc'): | ||
if _torch_version_div_indexing: |
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.
Actually, you can use torch.floor_divide
directly
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.
torch.floor_divide() is deprecated and will be removed in a future PyTorch release.
https://pytorch.org/docs/stable/generated/torch.floor_divide.html
We need to migrate the modification in MMDet 3.0 |
Should I summit a new pull request to branch dev-3.x? or it will be merged to 3.x automatically? |
@JiayuXu0 Hi, you can checkout from dev-3.x and create a new PR to dev-3.x. Thanks for your PR! |
* Fix floordiv warning. * Add floordiv wrapper.
* Fix floordiv warning. * Add floordiv wrapper.
Motivation
In SOLO code, floordiv is deprecated, and its behavior will change in a future version of pytorch.
Modification
torch.div(a, b, rounding_mode='trunc') is used to replace floordiv.