megengine.functional.expm1

expm1(x)[source]

Element-wise \(e^x - 1\) function.

Calculate the exponential of the elements minus 1 of input.

This function has domain [-infinity, +infinity] and codomain [-1, +infinity].

\[y_i = e^{x_i} - 1\]
Parameters

x – input tensor. Should have a floating-point data type.

Returns

a tensor containing the evaluated result for each element in \(x\). The returned tensor must have a floating-point data type determined by Type promotion rules.

Note

This function provides greater precision than \(\exp(x) - 1\) for small values of x. See FDLIBM, or some other IEEE 754-2019 compliant mathematical library, for a potential reference implementation.

Examples

>>> F.expm1(1e-10)
Tensor(1e-10, device=xpux:0)