本文主要是介绍torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate XXX,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
问题描述:torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 2.39 GiB. GPU 0 has a total capacty of 8.00 GiB of which 0 bytes is free. Of the allocated memory 9.50 GiB is allocated by PyTorch, and 2.24 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
解决办法:调小batch或者图片大小
这篇关于torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate XXX的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!