torch.logaddexp
function logaddexp(input: Tensor, other: Tensor, options?: BinaryOptions): TensorComputes log(exp(x) + exp(y)) element-wise in a numerically stable way.
Numerically stable even for large values
Parameters
inputTensor- First input tensor
otherTensor- Second input tensor
optionsBinaryOptionsoptional- Optional settings including
outparameter
Returns
Tensor– wise logaddexpExamples
const x = torch.tensor([1.0, 2.0, 3.0]);
const y = torch.tensor([2.0, 3.0, 4.0]);
torch.logaddexp(x, y); // numerically stable log(exp(x) + exp(y))