PyTorch torch.tanh Function
Pytorch torch Reference Manual
torch.tanhIt is a function in PyTorch used to compute the element-wise hyperbolic tangent.
Function Definition
torch.tanh(input, out=None)
Usage Example
Example
import torch
# Calculate hyperbolic tangent
x = torch.tensor([-1.0, 0.0, 1.0])
result = torch.tanh(x)
print(result)
# Calculate hyperbolic tangent
x = torch.tensor([-1.0, 0.0, 1.0])
result = torch.tanh(x)
print(result)
Other Extensions