EfficientDet.Pytorch icon indicating copy to clipboard operation
EfficientDet.Pytorch copied to clipboard

Gradient computation error

Open siaavashZ opened this issue 2 years ago • 2 comments

Hello When I run the train.py module, I get this error:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [3, 3]], which is output 0 of ReluBackward0, is at version 1; expected version 0 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

siaavashZ avatar May 19 '22 14:05 siaavashZ

met this issue too, is there any solutions?

mengfei25 avatar Jun 16 '22 04:06 mengfei25

Hello, I solved this In the models directory, you should change lines 178 and 180 of the bifpn.py module.

Just replace this

w1 /= torch.sum(w1, dim=0) + self.eps  # normalize

w2 /= torch.sum(w2, dim=0) + self.eps  # normalize

to this:

w1 = w1/(torch.sum(w1, dim=0) + self.eps)  # normalize

w2 = w2/(torch.sum(w2, dim=0) + self.eps)  # normalize

siaavashZ avatar Jun 18 '22 14:06 siaavashZ