其他分享
首页 > 其他分享> > one of the variables needed for gradient computation has been modified by an inplace operation

one of the variables needed for gradient computation has been modified by an inplace operation

作者:互联网

错误:

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [3, 32, 1, 1]] is at version 3; expected version 2 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!

解决:

更新pytorch版本。

我这里是1.5.1+cu101出现上述报错,换到1.1.0没有上述错误了。

完整粘贴:

 

标签:gradient,variables,modified,been,inplace,computation,operation
来源: https://www.cnblogs.com/wjjcjj/p/14484520.html