pytorch程序异常后删除占用的显存操作
时间:2021-03-08 11:41:03|栏目:Python代码|点击: 次
1-删除模型变量
del model_define
2-清空CUDA cache
torch.cuda.empty_cache()
3-步骤2(异步)需要一定时间,设置时延
time.sleep(5)
完整代码如下:
del styler torch.cuda.empty_cache() time.sleep(5)
上一篇:python读取csv文件并把文件放入一个list中的实例讲解
栏 目:Python代码
下一篇:python opencv minAreaRect 生成最小外接矩形的方法
本文地址:http://www.codeinn.net/misctech/76962.html






