其他分享
首页 > 其他分享> > with torch.no_grad() 和 @torch.no_grad()

with torch.no_grad() 和 @torch.no_grad()

作者:互联网

Pytorch中with torch.no_grad()或@torch.no_grad() 用法

https://www.cnblogs.com/douzujun/p/13364116.html

model.eval()                                # 测试模式
with torch.no_grad():
   pass
@torch.no_grad()
def eval():
	...

标签:no,梯度,torch,requires,eval,grad
来源: https://www.cnblogs.com/huzhengyu/p/16701781.html