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没有上述错误了。

完整粘贴:

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

 

上一篇:Gantt实例介绍分析


下一篇:软件工程基础 实验1《可行性研究与项目计划》