chainer.functions.elu

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

Exponential Linear Unit function.

For a parameter α, it is expressed as

f(x)={xif x0α(exp(x)1)if x<0,

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

Parameters
  • x (Variable or N-dimensional array) – Input variable. A (s1,s2,...,sN)-shaped float array.

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

Returns

Output variable. A (s1,s2,...,sN)-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)