PyTorch torch.logaddexp function


Pytorch torch 参考手册PyTorch torch reference manual

torch.logaddexpis a function in PyTorch used to compute log(exp(x) + exp(y)).

Function definition

torch.logaddexp(input, other)

Usage example

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)
print("logaddexp:", z)

The output is:

logaddexp: tensor([3.0486, 4.0181])

Pytorch torch 参考手册PyTorch torch reference manual

Other extensions