.atanh()
Published Mar 28, 2025
Contribute to Docs
The .atanh()
function in PyTorch calculates the inverse hyperbolic tangent for each value in a tensor.
Syntax
torch.atanh(input, *, out=None)
Parameters:
input
(Tensor): A tensor containing values strictly between -1 and 1 (exclusive).out
(Tensor, optional): The output tensor to store the result. If not provided, a new tensor is created.
Return Value:
Returns a new tensor where each value is the inverse hyperbolic tangent of the corresponding value in input
.
Example
The following example demonstrates the usage of the .atanh()
function:
import torch# Create a tensorx = torch.tensor([0.5, -0.3, 0.0])# Calculate the inverse hyperbolic tangenty = torch.atanh(x)# Print the resultprint(y)
The above code produces the following output:
tensor([ 0.5493, -0.3095, 0.0000])
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn PyTorch on Codecademy
- Career path
Data Scientist: Machine Learning Specialist
Machine Learning Data Scientists solve problems at scale, make predictions, find patterns, and more! They use Python, SQL, and algorithms.Includes 27 CoursesWith Professional CertificationBeginner Friendly95 hours - Free course
Intro to PyTorch and Neural Networks
Learn how to use PyTorch to build, train, and test artificial neural networks in this course.Intermediate3 hours