今天在运行一个训练好的模型的时候,出现里如下错误:
RuntimeError: CUDA out of memory. Tried to allocate 564.00 MiB (GPU 0; 7.79 GiB total capacity; 5.79 GiB already allocated; 302.00 MiB free; 5.83 GiB reserved in total by PyTorch)
所用设备:游戏本,8GB的显存
解决方法:加上with torch.no_grad():
参考资料:https://www.jianshu.com/p/fbe3efd91807