pytorch代碼中常見的問題

1.

  molded_images = Variable(molded_images, volatile=True)

  運行提示:UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.

# Wrap in variable
        with torch.no_grad():
            molded_images = Variable(molded_images)

2.

loss.data[0]

替換爲

loss.item()

 

 

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