https://blog.csdn.net/Answer3664/article/details/99460175

  • requires_grad=True 要求计算梯度

  • requires_grad=False 不要求计算梯度

  • with torch.no_grad()或者@torch.no_grad()中的数据不需要计算梯度,也不会进行反向传播

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

相关文章:

  • 2022-12-23
  • 2021-09-02
  • 2022-01-16
  • 2022-12-23
  • 2021-09-30
  • 2022-01-21
  • 2021-05-16
  • 2022-03-09
猜你喜欢
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-08
  • 2021-10-02
相关资源
相似解决方案