elu

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

elu activation.

elu(x)={x,if  x>0alpha(ex1),if  x<=0
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) – For details, please refer to Name. Generally, no setting is required. Default: None.

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)
>>> print(out)
Tensor(shape=[2, 2], dtype=float32, place=Place(cpu), stop_gradient=True,
[[-0.12642412,  6.        ],
 [ 1.        , 15.60000038]])