megengine.functional.exp#
- exp(x)[source]#
Element-wise \(e^x\) function.
Calculates an approximation to the exponential function for each element \(x_i\) of the input tensor \(x\) (\(e\) raised to the power of \(x_i\), where \(e\) is the base of the natural logarithm).
This function has domain
[-infinity, +infinity]
and codomain[+0, +infinity]
.- Parameters:
x – input tensor. Should have a floating-point data type.
- Returns:
a tensor containing the evaluated exponential function result for each element in \(x\). The returned tensor must have a floating-point data type determined by Type promotion rules.
Special cases
For floating-point operands,
If \(x_i\) is
NaN
, the result isNaN
.If \(x_i\) is
+0
, the result is1
.If \(x_i\) is
-0
, the result is1
.If \(x_i\) is
+infinity
, the result is+infinity
.If \(x_i\) is
-infinity
, the result is+0
.
Examples
>>> F.exp([0, F.log(2)]) Tensor([1. 2.], device=xpux:0)