赞
踩
1测试的时候不需要梯度反向传播时,使用
with torch.no_grad()
2在计算累计损失时,使用
total_loss+=loss.item()
将tensor转为非tensor
3.在保证batchsize尽可能大的条件下,调小batchsize
4.释放gpu显存
torch.cuda.empty_cache()
监控GPU的使用情况
nividia-smi
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。