Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.tanh function

PyTorch torch.tanh function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual