Skip to content

Commit 7ccc690

Browse files
authoredMar 12, 2025
Acosh Article Written (#6311)
* Wrote the initial article * Rephrased a few sentences * Minor changes * minor fixes ---------
1 parent 9f3606a commit 7ccc690

File tree

1 file changed

+61
-0
lines changed
  • content/pytorch/concepts/tensor-operations/terms/acosh

1 file changed

+61
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
Title: '.acosh()'
3+
Description: 'Computes the inverse hyperbolic cosine of elements in a PyTorch tensor.'
4+
Subjects:
5+
- 'Computer Science'
6+
- 'Data Science'
7+
Tags:
8+
- 'Deep Learning'
9+
- 'Programming'
10+
- 'PyTorch'
11+
CatalogContent:
12+
- 'intro-to-py-torch-and-neural-networks'
13+
- 'paths/data-science'
14+
---
15+
16+
The **`.acosh()`** method in PyTorch computes the inverse hyperbolic cosine of each element in a [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors). This operation is applied element-wise and is commonly used in scientific computations involving hyperbolic functions.
17+
18+
## Syntax
19+
20+
```pseudo
21+
torch.acosh(input, *, out=None) → Tensor
22+
```
23+
24+
**Parameters:**
25+
26+
- `input`: The input tensor containing values greater than or equal to 1.
27+
- `out` (Optional): The output tensor to store the result. If not provided, a new tensor is created.
28+
29+
**Returns:**
30+
31+
A tensor with the inverse hyperbolic cosine of each element from the input tensor.
32+
33+
## Example
34+
35+
This example shows how to use `.acosh()` to compute the inverse hyperbolic cosine of a tensor:
36+
37+
```py
38+
import torch
39+
40+
# Define a tensor with values >= 1
41+
input_tensor = torch.tensor([1.0, 2.0, 3.0, 10.0])
42+
43+
# Compute the inverse hyperbolic cosine
44+
output_tensor = torch.acosh(input_tensor)
45+
46+
print("Input Tensor:")
47+
print(input_tensor)
48+
49+
print("\nOutput Tensor:")
50+
print(output_tensor)
51+
```
52+
53+
This example results in the following output:
54+
55+
```shell
56+
Input Tensor:
57+
tensor([ 1., 2., 3., 10.])
58+
59+
Output Tensor:
60+
tensor([0.0000, 1.3169, 1.7627, 2.9932])
61+
```

0 commit comments

Comments
 (0)