chainer.functions.crelu

chainer.functions.crelu(x, axis=1)[source]

Concatenated Rectified Linear Unit function.

This function is expressed as follows

\[f(x) = (\max(0, x), \max(0, -x)).\]

Here, two output values are concatenated along an axis.

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

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

  • axis (int) – Axis that the output values are concatenated along. Default is 1.

Returns

Output variable of concatenated array. If the axis is 1, A \((s_1, s_2 \times 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.crelu(x, axis=1)
>>> y.array
array([[0., 0., 1., 0.],
       [2., 0., 0., 3.]], dtype=float32)