Гиперболический тангенс python torch

torch.tanh¶

Returns a new tensor with the hyperbolic tangent of the elements of input .

input (Tensor) – the input tensor.

out (Tensor, optional) – the output tensor.

>>> a = torch.randn(4) >>> a tensor([ 0.8986, -0.7279, 1.1745, 0.2611]) >>> torch.tanh(a) tensor([ 0.7156, -0.6218, 0.8257, 0.2553]) 

© Copyright 2023, PyTorch Contributors.

Docs

Access comprehensive developer documentation for PyTorch

Tutorials

Get in-depth tutorials for beginners and advanced developers

Resources

Find development resources and get your questions answered

© Copyright The Linux Foundation. The PyTorch Foundation is a project of The Linux Foundation. For web site terms of use, trademark policy and other policies applicable to The PyTorch Foundation please see www.linuxfoundation.org/policies/. The PyTorch Foundation supports the PyTorch open source project, which has been established as PyTorch Project a Series of LF Projects, LLC. For policies applicable to the PyTorch Project a Series of LF Projects, LLC, please see www.lfprojects.org/policies/.

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.

Источник

Tanh¶

Applies the Hyperbolic Tangent (Tanh) function element-wise.

Tanh ( x ) = tanh ⁡ ( x ) = exp ⁡ ( x ) − exp ⁡ ( − x ) exp ⁡ ( x ) + exp ⁡ ( − x ) \text(x) = \tanh(x) = \frac Tanh ( x ) = tanh ( x ) = exp ( x ) + exp ( − x ) exp ( x ) − exp ( − x ) ​

../_images/Tanh.png

Shape:

  • Input: ( ∗ ) (*) ( ∗ ) , where ∗ * ∗ means any number of dimensions.
  • Output: ( ∗ ) (*) ( ∗ ) , same shape as the input.
>>> m = nn.Tanh() >>> input = torch.randn(2) >>> output = m(input) 

© Copyright 2023, PyTorch Contributors.

Docs

Access comprehensive developer documentation for PyTorch

Tutorials

Get in-depth tutorials for beginners and advanced developers

Resources

Find development resources and get your questions answered

© Copyright The Linux Foundation. The PyTorch Foundation is a project of The Linux Foundation. For web site terms of use, trademark policy and other policies applicable to The PyTorch Foundation please see www.linuxfoundation.org/policies/. The PyTorch Foundation supports the PyTorch open source project, which has been established as PyTorch Project a Series of LF Projects, LLC. For policies applicable to the PyTorch Project a Series of LF Projects, LLC, please see www.lfprojects.org/policies/.

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.

Источник

Tanhshrink¶

../_images/Tanhshrink.png

Shape:

  • Input: ( ∗ ) (*) ( ∗ ) , where ∗ * ∗ means any number of dimensions.
  • Output: ( ∗ ) (*) ( ∗ ) , same shape as the input.
>>> m = nn.Tanhshrink() >>> input = torch.randn(2) >>> output = m(input) 

© Copyright 2023, PyTorch Contributors.

Docs

Access comprehensive developer documentation for PyTorch

Tutorials

Get in-depth tutorials for beginners and advanced developers

Resources

Find development resources and get your questions answered

© Copyright The Linux Foundation. The PyTorch Foundation is a project of The Linux Foundation. For web site terms of use, trademark policy and other policies applicable to The PyTorch Foundation please see www.linuxfoundation.org/policies/. The PyTorch Foundation supports the PyTorch open source project, which has been established as PyTorch Project a Series of LF Projects, LLC. For policies applicable to the PyTorch Project a Series of LF Projects, LLC, please see www.lfprojects.org/policies/.

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.

Источник

Читайте также:  Php array viewer online
Оцените статью