首页 文章

pytorch中的tensorflow stop_gradient等价物

提问于
浏览
0

什么是 tf.stop_gradient() 等效(在反向传播期间提供了一种不计算某些变量的梯度的方法)?

2 回答

  • 2

    你能用x.detach()查看 .

  • 1

    pytorch中的张量具有requires_grad属性 . 将其设置为 False 以防止该张量的梯度计算 .

相关问题