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 RuntimeError due to inplace operation (fpn.py) #493

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

y-okumura-isp
Copy link

Thank you for great OSS!

When we use FPN, we get the following error on torch==1.13.1.
It looks like this is due to an in-place update of laterals at FPN.forward() in fpn.py.

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 64, 20, 20]], which is output 0 of LeakyReluBackward1, is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

Here is the difference of yaml file.

$ git diff config/nanodet-plus-m_320.yml
     fpn:
-      name: GhostPAN
+      name: FPN # GhostPAN
       in_channels: [116, 232, 464]
-      out_channels: 96
-      kernel_size: 5
-      num_extra_level: 1
-      use_depthwise: True
+      num_outs: 3
+      out_channels: 96
       activation: LeakyReLU
     head:
-      strides: [8, 16, 32, 64]
+      strides: [8, 16, 32]
     aux_head:
-      strides: [8, 16, 32, 64]
+      strides: [8, 16, 32]
@alessiamarcolini
Copy link

Thank you for the fix @y-okumura-isp !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants