Python 3.x Cuda内存不足,尽管它可用

Python 3.x Cuda内存不足,尽管它可用,python-3.x,memory-management,pytorch,Python 3.x,Memory Management,Pytorch,我正在尝试对一些大小为256x256的图像进行扫描。但是,每当我开始培训时,我都会收到以下错误: RuntimeError: CUDA out of memory. Tried to allocate 2.19 GiB (GPU 0; 10.00 GiB total capacity; 437.15 MiB already allocated; 6.38 GiB free; 1.51 GiB reserved in total by PyTorch) 我不知道怎么解决它。似乎内存充足,所以我不

我正在尝试对一些大小为256x256的图像进行扫描。但是,每当我开始培训时,我都会收到以下错误:

RuntimeError: CUDA out of memory. Tried to allocate 2.19 GiB (GPU 0; 10.00 GiB total capacity; 437.15 MiB already allocated; 6.38 GiB free; 1.51 GiB reserved in total by PyTorch)

我不知道怎么解决它。似乎内存充足,所以我不明白为什么会发生这种情况。

尝试较小的批量大小。