fn
expm1
→Tensorexpm1(x: Tensor)Element-wise .
Computes the exponential-minus-one function. The current composite
implementation evaluates the naive form exp(x) - 1; a dedicated
engine primitive would additionally preserve relative accuracy for
, but the algebraic result is identical.
Parameters
xTensorInput 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.71828, 6.38906])