Torch.tanh Vs Torch.nn.functional.tanh - PyTorch Forums
Có thể bạn quan tâm
A little confusing that both exist. Is any of these deprecated?
2 Likes smth April 3, 2018, 8:13pm 2we should now deprecate torch.nn.functional.tanh on master, as tensors and variables are now merged.
7 Likes jpeg729 (jpeg729) April 4, 2018, 9:24am 4If I use nn.Tanh I have to declare it in my_model.init(), e.g.
self.tanh = nn.Tanh()Whereas I can use nn.functional.tanh directly in my_model.forward(), e.g.
output = nn.functional.tanh(input)If you deprecate nn.functional.tanh I could do
output = nn.Tanh()(input)where ever I need the functional form, but it would be slower because of the class instantiation.
What has this to do with Variables and Tensors? I am confused.
2 Likes alexis-jacq (Alexis David Jacq) April 4, 2018, 2:08pm 5If you deprecate nn.functional.tanh I could do
output = nn.Tanh()(input)
Or you could still use torch.tanh():
output = input.tanh() 5 Likes banikr February 5, 2020, 9:57pm 6I am expecting output having both positive and negative values. So,
output = torch.tanh(model(input)) in the final output of network should be fine?
Or are any other variants available?
mathematics (Rajan) July 7, 2020, 2:13pm 7There are only few activations like torch.tanh in torch. But for torch.nn.functional , i found alot of functional activations. Why is that?
yrluo (Chang) November 25, 2020, 8:15pm 8Same confusion here 
Từ khóa » F.tanh Pytorch
-
Torch.nn.functional.tanh — PyTorch 1.12 Documentation
-
Tanh — PyTorch 1.12 Documentation
-
Torch.nn.functional — PyTorch 1.12 Documentation
-
Torch.tanh — PyTorch 1.12 Documentation
-
Python Examples Of Torch.nn.functional.tanh
-
Python | PyTorch Tanh() Method - GeeksforGeeks
-
Why Tanh Function Return Different In Tensorflow And Pytorch?
-
What Is PyTorch Tanh With Examples? - EduCBA
-
Machine-learning-articles/using-relu-sigmoid-and-tanh-with-pytorch ...
-
[activations] Pytorch-1.11+ Tanh Gelu Approximation #15397 - GitHub
-
Python Functional.tanh方法代碼示例- 純淨天空
-
Python Torch.nn.functional 模块,tanh() 实例源码 - 编程字典
-
Torch.nn.functional - PyTorch - W3cubDocs