PyTorch torch.tanh function
PyTorch torch reference manual
torch.tanh is a function in PyTorch used to compute the element-wise hyperbolic tangent.
Function definition
torch.tanh(input, out=None)
Usage examples
Example
import
torch
Compute the hyperbolic tangent
x
=
torch.
tensor
(
[
1.0
,
0.0
,
1.0
]
)
result
=
torch.
tanh
(
x
)
(
result
)