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运行

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