chainer.functions.softplus

chainer.functions.softplus(x, beta=1.0)[source]

Element-wise softplus function.

The softplus function is the smooth approximation of ReLU.

\[f(x)=\frac{1}{\beta}\log(1 + \exp(\beta x)),\]

where \(\beta\) is a parameter. The function becomes curved and akin to ReLU as the \(\beta\) is increasing.

Parameters
Returns

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

Return type

Variable

Example

>>> x = np.arange(-2, 3, 2).astype(np.float32)
>>> x
array([-2.,  0.,  2.], dtype=float32)
>>> F.softplus(x, beta=1.0).array
array([0.126928 , 0.6931472, 2.126928 ], dtype=float32)