在报错的代码前后都加上这两句代码:
if hasattr(torch.cuda, 'empty_cache'):
torch.cuda.empty_cache()
再跑就可以了
原文从这里看到的
记录一下我的学习过程。
在报错的代码前后都加上这两句代码:
if hasattr(torch.cuda, 'empty_cache'):
torch.cuda.empty_cache()
再跑就可以了
原文从这里看到的
记录一下我的学习过程。