megengine.functional.exp¶
- exp(x)[源代码]¶
 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].- 参数
 x – input tensor. Should have a floating-point data type.
- 返回
 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 类型提升规则.
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.
实际案例
>>> F.exp([0, F.log(2)]) Tensor([1. 2.], device=xpux:0)