elu

paddle.nn.functional. elu ( x, alpha=1.0, name=None ) [source]

elu activation.

\[\begin{split}elu(x)= \left\{ \begin{array}{lcl} x,& &\text{if } \ x > 0 \\ alpha * (e^{x} - 1),& &\text{if } \ x <= 0 \end{array} \right.\end{split}\]
Parameters
  • x (Tensor) – The input Tensor with data type float32, float64.

  • alpha (float, optional) – The ‘alpha’ value of the ELU formulation. Default is 1.0.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

A Tensor with the same data type and shape as x .

Examples

import paddle
import paddle.nn.functional as F

x = paddle.to_tensor([[-1., 6.], [1., 15.6]])
out = F.elu(x, alpha=0.2)
# [[-0.12642411  6.        ]
#  [ 1.          15.6      ]]