pytorch: cuda out of memory

csdn

解决办法

在报错哪一行前面加上下面两行:释放无关的内存

if hasattr(torch.cuda, 'empty_cache'):
	torch.cuda.empty_cache()
posted @ 2021-03-09 21:55  zae  阅读(365)  评论(0)    收藏  举报