zergtant / pytorch-handbook

pytorch handbook是一本开源的书籍,目标是帮助那些希望和使用PyTorch进行深度学习开发和研究的朋友快速入门,其中包含的Pytorch教程全部通过测试保证可以成功运行
20.1k stars 5.39k forks source link

torch.cuda.empty_cache() 不能释放显存 #130

Open smoftsky opened 2 years ago

smoftsky commented 2 years ago

用了torch.cuda.empty_cache()后,在控制台nvidia-smi查看显存没有释放,在Ipython控制台继续添加网络后显存继续上升。是我对相关的内存机制理解有问题,还是是因为我用的是spyder而和spyder运行特性有关呢?求助大佬。