pytorch 中的 tensorflow stop_gradient 等效项

标签 tensorflow pytorch

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

最佳答案

你能不能用 x.detach() 检查一下。

关于pytorch 中的 tensorflow stop_gradient 等效项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51529974/

相关文章:

python - 是否可以修改现有的 TensorFlow 计算图?

neural-network - 在深度神经网络中使用卷积 1x1 的原因是什么?

deep-learning - 神经网络中密集层之后的激活函数有多必要?

tensorflow - Pytorch 中的 dim 和 Tensorflow 中的 axis 有什么区别?

python - 手动双向 torch.nn.RNN 实现

python - 记录由 tensorflow 服务模型服务的请求

graph - tensorflow : how to insert custom input to existing graph?

python - Keras 函数模型提供高验证准确性但不正确的预测

deep-learning - a.sub(or*a.grad) 实际上做了什么?

coding-style - PyTorch 中是否存在干净且可扩展的 LSTM 实现?