.acosh()
Anonymous contributor
Published Mar 12, 2025
Contribute to Docs
The .acosh()
method in PyTorch computes the inverse hyperbolic cosine of each element in a tensor. This operation is applied element-wise and is commonly used in scientific computations involving hyperbolic functions.
Syntax
torch.acosh(input, *, out=None) → Tensor
Parameters:
input
: The input tensor containing values greater than or equal to 1.out
(Optional): The output tensor to store the result. If not provided, a new tensor is created.
Returns:
A tensor with the inverse hyperbolic cosine of each element from the input tensor.
Example
This example shows how to use .acosh()
to compute the inverse hyperbolic cosine of a tensor:
import torch# Define a tensor with values >= 1input_tensor = torch.tensor([1.0, 2.0, 3.0, 10.0])# Compute the inverse hyperbolic cosineoutput_tensor = torch.acosh(input_tensor)print("Input Tensor:")print(input_tensor)print("\nOutput Tensor:")print(output_tensor)
This example results in the following output:
Input Tensor:tensor([ 1., 2., 3., 10.])Output Tensor:tensor([0.0000, 1.3169, 1.7627, 2.9932])
All contributors
- Anonymous contributor
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