问题遇到的现象和发生背景
使用pytorch的dcgan训练过程中出现out of memory
问题相关代码,请勿粘贴截图
运行结果及报错内容
RuntimeError: CUDA out of memory. Tried to allocate 136.00 MiB (GPU 0; 4.00 GiB total capacity; 67.25 MiB already allocated; 2.30 GiB free; 96.00 MiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF
我的解答思路和尝试过的方法
尝试修改虚拟内存大小,毫无作用
运行时偶尔还会发生pycharm崩溃
我想要达到的结果
比较疑惑的就是可用内存还不少的样子为什么分配给pytorch的内存这么小以及这个情况除了换显卡还有什么可以尝试一下的解决办法