chainer.functions.elu

chainer.functions.elu(x, alpha=1.0)[source]

Exponential Linear Unit function.

For a parameter \(\alpha\), it is expressed as

\[\begin{split}f(x) = \left \{ \begin{array}{ll} x & {\rm if}~ x \ge 0 \\ \alpha (\exp(x) - 1) & {\rm if}~ x < 0, \end{array} \right.\end{split}\]

See: https://arxiv.org/abs/1511.07289

Parameters
  • x (Variable or N-dimensional array) – Input variable. A \((s_1, s_2, ..., s_N)\)-shaped float array.

  • alpha (float) – Parameter \(\alpha\). Default is 1.0.

Returns

Output variable. A \((s_1, s_2, ..., s_N)\)-shaped float array.

Return type

Variable

Example

>>> x = np.array([[-1, 0], [2, -3]], np.float32)
>>> x
array([[-1.,  0.],
       [ 2., -3.]], dtype=float32)
>>> y = F.elu(x, alpha=1.)
>>> y.array
array([[-0.63212055,  0.        ],
       [ 2.        , -0.95021296]], dtype=float32)