TensorPlay
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-15

tensorplay.functional.logaddexp

tensorplay.functional.logaddexp(input, other, *, out=None) → Tensor[source]

Logarithm of the sum of exponentiations of the inputs.

Calculates pointwise log⁡(ex+ey)\log\left(e^x + e^y\right). This function is useful in statistics where the calculated probabilities of events may be so small as to exceed the range of normal floating point numbers. In such cases the logarithm of the calculated probability is stored. This function allows adding probabilities stored in such a fashion.

This op should be disambiguated with tensorplay.logsumexp() which performs a reduction on a single tensor.

Parameters:
  • input (Tensor) – the input tensor.

  • other (Tensor) – the second input tensor

Keyword Arguments:

out (Tensor, optional) – the output tensor.

Example:

>>> tensorplay.logaddexp(tensorplay.tensor([-1.0]), tensorplay.tensor([-1.0, -2, -3]))
tensor([-0.3069, -0.6867, -0.8731])
>>> tensorplay.logaddexp(tensorplay.tensor([-100.0, -200, -300]), tensorplay.tensor([-1.0, -2, -3]))
tensor([-1., -2., -3.])
>>> tensorplay.logaddexp(tensorplay.tensor([1.0, 2000, 30000]), tensorplay.tensor([-1.0, -2, -3]))
tensor([1.1269e+00, 2.0000e+03, 3.0000e+04])

On this page

Ask DeepWiki