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
Avoid branching in BasicBlock and Bottleneck #8187
base: main
Are you sure you want to change the base?
Conversation
Avoid branching during forward pass in BasicBlock and Bottleneck block for better performance.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/vision/8187
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (10 Unrelated Failures)As of commit 38fa921 with merge base ae6b134 (): FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Thanks for the PR @kevinMEH. I suspect the performance gain coming from removing a single |
Every single block layer has an if removed. I think that the performance gain is pretty substantial, however as of right now I cannot spare any GPU time to test it. I will test it once I regain access to a GPU. |
Thanks, let's wait for benchmarks before moving forward with this then. We should also remember that this |
Avoid branching during forward pass in BasicBlock and Bottleneck block for better performance.
Completely backwards compatible; downsampled = nn.Identity(x) is equivalent to downsampled = x
Should be always more performant, unless nn.Identity adds some kind of penalty during backprop.