Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.logaddexp function

PyTorch torch.logaddexp function


PyTorch torch reference manual 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

)

print

(

"logaddexp:"

,

z

)

The output is:

logaddexp: tensor([3.0486, 4.0181])


PyTorch torch reference manual PyTorch torch reference manual