chainer.functions.relu(x)[source]

Rectified Linear Unit function.

 

\[f(x)=\max(0, x).\]
Parameters: x (Variable or numpy.ndarray or cupy.ndarray) –入力値。  A\((s_1, s_2, ..., s_N)\)--型の float 配列。
Returns: 出力値。 A\((s_1, s_2, ..., s_N)\)--型の float 配列。
Return type: Variable

 

Example

 


>>> x = np.array([[-1, 0], [2, -3], [-2, 1]], 'f')
>>> np.any(x < 0)
True
>>> y = F.relu(x)
>>> np.any(y.data < 0)
False
>>> y.shape (3, 2)