PyTorch torch.logaddexp function
PyTorch torch reference manual
torch.logaddexp is a function in PyTorch used to compute log(exp(x) + exp(y)).
Function definition
torch.logaddexp(input, other)
Usage examples
Example
import
torch
Compute log(exp(x) + exp(y))
x
=
torch.
tensor
(
[
1.0
,
2.0
]
)
y
=
torch.
tensor
(
[
3.0
,
4.0
]
)
z
=
torch.
logaddexp
(
x
,
y
)
(
"logaddexp:"
,
z
)
The output is:
logaddexp: tensor([3.0486, 4.0181])