Skip to content
fn

logaddexp_op

→TensorImplPtr
int logaddexp_op(const int & a, const int & b)

Python wrappers

Public Python APIs implemented by this engine symbol.

Numerically-stable log⁡(exp⁡(a)+exp⁡(b))\log(\exp(a) + \exp(b)) via the max-shift trick.

Composite over maximum_op + sub_op + exp_op + add_op + log_op. Factoring out the per-pair max keeps the exponent's argument ≤0\le 0 so the underflow side bears the rounding error rather than the overflow side.

Math

y=m+ln⁡ ⁣(ea−m+eb−m),m=max⁡(a,b) y = m + \ln\!\left( e^{a - m} + e^{b - m} \right), \qquad m = \max(a, b)

See Also

logsumexp_op — generalised reduction over axes.

Parameters

a, bTensorImplPtr
Broadcastable operands.

Returns

TensorImplPtr

Tensor on the broadcast shape.