【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

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