【Pytorch】RuntimeError: one of the variables needed for gradient computation has been modified by

参考:RuntimeError: one of the variables needed for gradient computation has been modified by an inplace o

报错

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

解决办法

检查自己的pytorch相关的代码,把所有类似x += 1的操作,全部换成x = x + 1

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章