You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: 'Computes the logarithm of the sum of exponentials of two tensors in base 2.'
4
+
Subjects:
5
+
- 'Code Foundations'
6
+
- 'Computer Science'
7
+
Tags:
8
+
- 'PyTorch'
9
+
- 'Tensor'
10
+
CatalogContent:
11
+
- 'learn-pytorch'
12
+
- 'intro-to-py-torch-and-neural-networks'
13
+
---
14
+
15
+
In PyTorch, the **`.logaddexp2()`** function computes the element-wise $$log_2(2^x + 2^y)$$ of the given [tensor](https://www.codecademy.com/resources/docs/pytorch/tensors) inputs.
16
+
17
+
## Syntax
18
+
19
+
```pseudo
20
+
torch.logaddexp2(input,other,*,out=None)
21
+
```
22
+
23
+
**Parameters:**
24
+
25
+
-`input`: The first input tensor
26
+
-`other`: The second input tensor
27
+
-`out`: The output tensor to store the result. Default is `None`.
28
+
29
+
**Return value:**
30
+
31
+
The `torch.logaddexp2()` method returns a tensor containing the element-wise logarithm (base 2) of the sum of exponentials of the corresponding elements in the input tensors.
32
+
33
+
## Example
34
+
35
+
In this example, `torch.logaddexp2()` is used to combine two tensors into a single tensor by computing their log-sum in base 2:
0 commit comments