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

fix amp pooling overflow #9670

Merged
merged 9 commits into from
Jan 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update mmdet/models/backbones/csp_darknet.py
Co-authored-by: Wenwei Zhang <[email protected]>
  • Loading branch information
zylo117 and ZwwWayne authored Jan 29, 2023
commit c55cb1e1a27bac04e3b54bb8ad1953fa6c5d3dc1
5 changes: 1 addition & 4 deletions mmdet/models/backbones/csp_darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,7 @@ def __init__(self,

def forward(self, x):
x = self.conv1(x)
if x.dtype == torch.float16:
x = x.float()
x = torch.cat([x] + [pooling(x) for pooling in self.poolings], dim=1).half()
else:
with torch.autocast(enabled=False):
x = torch.cat([x] + [pooling(x) for pooling in self.poolings], dim=1)
x = self.conv2(x)
return x
Expand Down