RuntimeError: CUDA out of memory.

报错

RuntimeError: CUDA out of memory. Tried to allocate 636.00 MiB (GPU 0; 10.76 GiB total capacity; 3.77 GiB already allocated; 497.25 MiB free; 4.67 GiB reserved in total by PyTorch)

解决方案

一、清空GPU缓存

nvidia-smi
RuntimeError: CUDA out of memory._第1张图片

2.查看正在运行的进程

fuser -v /dev/nvidia*
RuntimeError: CUDA out of memory._第2张图片

3.kill进程

kill -9 PID
RuntimeError: CUDA out of memory._第3张图片

你可能感兴趣的:(pytorch,深度学习,python)