SSD-variants
SSD-variants copied to clipboard
Inplace Operations Error
Hey,
I am trying to run this with pytorch 1.0.0 and get the following error
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
Any suggestions?
Thanks!
Hey,
I am also trying to run with pytorch 1.0.0 and getting the same error.
Trying to resolve this. Will let you know if i will find any solution.
Thanks.
Just solved it. The error is in models/SSD.py
The inplace operation happens in the class L2Norm
. Replace that with this (courtesy amdegroot/ssd.pytorch):
class L2Norm(nn.Module):
def __init__(self,n_channels, scale=20):
super(L2Norm,self).__init__()
self.weight = nn.Parameter(torch.Tensor(n_channels))
nn.init.constant_(self.weight, scale)
def forward(self, x):
norm = x.pow(2).sum(dim=1, keepdim=True).sqrt()+1e-10
x = torch.div(x,norm)
out = self.weight.unsqueeze(0).unsqueeze(2).unsqueeze(3).expand_as(x) * x
return out
Hi guys. Are you able to achieve the same reported accuracy training from scratch using this repo code? Thanks!