Pytorch 为什么不';t torch.functional.sigmoid和torch.nn.functional.relu像torch.nn.functional.tanh一样被弃用?
现在,当Pytorch 为什么不';t torch.functional.sigmoid和torch.nn.functional.relu像torch.nn.functional.tanh一样被弃用?,pytorch,deprecated,Pytorch,Deprecated,现在,当torch.autograd.Variable与torch.tensor合并并过时时,为什么他们不赞成torch.nn.functional中的某些函数而反对其他函数?也就是说,tanh被弃用,但不是sigmoid或relu >>> torch.__version__ '1.1.0' >>> u tensor(2., grad_fn=<MeanBackward0>) >>> torch.nn.functional.tanh
torch.autograd.Variable
与torch.tensor
合并并过时时,为什么他们不赞成torch.nn.functional
中的某些函数而反对其他函数?也就是说,tanh
被弃用,但不是sigmoid
或relu
>>> torch.__version__
'1.1.0'
>>> u
tensor(2., grad_fn=<MeanBackward0>)
>>> torch.nn.functional.tanh(u)
C:\Users\mlearning\AppData\Local\Continuum\anaconda3\lib\site-packages\torch\nn\functional.py:1374: UserWarning: nn.functional.tanh is deprecated. Use torch.tanh instead.
warnings.warn("nn.functional.tanh is deprecated. Use torch.tanh instead.")
tensor(0.9640, grad_fn=<TanhBackward>)
>>> torch.nn.functional.sigmoid(u)
tensor(0.8808, grad_fn=<SigmoidBackward>)
>>> torch.nn.functional.relu(u)
tensor(2., grad_fn=<ReluBackward0>)
>>火炬.\u版本__
'1.1.0'
>>>u
张量(2,梯度fn=)
>>>火炬。nn。功能。tanh(u)
C:\Users\mlearning\AppData\Local\Continuum\anaconda3\lib\site packages\torch\nn\functional.py:1374:UserWarning:nn.functional.tanh不推荐使用。用torch.tanh代替。
warnings.warn(“nn.functional.tanh已弃用。请改用torch.tanh。”)
张量(0.9640,梯度fn=)
>>>火炬。nn。功能性。乙状结肠(u)
张量(0.8808,梯度fn=)
>>>torch.nn.functional.relu(u)
张量(2,梯度fn=)
torch.nn.functional.relu
和torch.relu
之间有什么区别吗?或者我可以互换使用它们?您可以检查PyTorch的几个主要设计师(实际上是创建者)中的一个在哪里设置了指令
您还可以检查背后的原因。此外,您还可以为其他2个功能提出相同的建议
另一种也应该反对。这种设计选择很难回答。最好在Github上询问这些问题,以便开发人员更容易看到它们。关于用法:应该没有用法差异,但是如果一个不推荐使用,另一个不推荐使用,最好使用后者。