Element-wise .
Computes the exponential-minus-one function to full relative precision,
including for , where exp(x) - 1 cancels: in
float32 that naive form returned 1.19e-7 for x = 1e-7 (19% off)
and 0 below it.
Parameters
inputTensorInput tensor. Any floating-point dtype.
Returns
TensorElement-wise .
Notes
Mathematical definition:
The function is useful in probability and finance where is
a small log-difference, since log(1 + y) = expm1⁻¹(y) and the pair
avoids subtractive cancellation when chained.
Examples
>>> import lucid
>>> x = lucid.tensor([0.0, 1.0, 2.0])
>>> lucid.expm1(x)
tensor([0., 1.718, 6.389])