You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [200, 6]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 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!
which I narrowed down to the following line in models.py. By changing it from return self.linear_2(x) to return self.linear_2(x.clone().detach()) in the ParticlePredictor class, I get rid of this gradient error, but now I cannot reproduce the results from the paper for RiceGrip. I'm not sure if detaching this variable from the gradient computation graph is causing this issue, but I'm not sure how else to get this code to run. Are there any solutions? FYI I'm running PyTorch 2.2.1
The text was updated successfully, but these errors were encountered:
I get the following PyTorch Gradient Error:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [200, 6]], which is output 0 of AsStridedBackward0, is at version 2; expected version 1 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!
which I narrowed down to the following line in models.py. By changing it from
return self.linear_2(x)
toreturn self.linear_2(x.clone().detach())
in theParticlePredictor
class, I get rid of this gradient error, but now I cannot reproduce the results from the paper for RiceGrip. I'm not sure if detaching this variable from the gradient computation graph is causing this issue, but I'm not sure how else to get this code to run. Are there any solutions? FYI I'm running PyTorch 2.2.1The text was updated successfully, but these errors were encountered: