Pytorch顯存問題

運行出現錯誤:

RuntimeError: CUDA out of memory. Tried to allocate 500.00 MiB (GPU 0; 4.00 GiB total capacity; 204.39 MiB already allocated; 363.42 MiB free; 373.61 MiB cached)

解決方法: 釋放顯存
torch.cuda.empty_cache()

如果還是解決不了:
(1)增加顯存
(2)切換爲CPU運行

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