chainer.functions.leaky_relu(x, slope=0.2)[source]

Leaky Rectified Linear Unit 関数。

 

この関数は下記の式で表される。

 

f(x)={xaxif x0if x<0,f(x)={xif x≥0axif x<0,

 

aは、設定可能な傾きの値です。

 

Parameters:
Returns:

出力値。A (s_1, s_2, ..., s_n)型のfloat配列

Return type:

Variable

 

Example

 


>>> x = np.array([[-1, 0], [2, -3], [-2, 1]], 'f')
>>> x
array([[-1., 0.],
[ 2., -3.],
[-2., 1.]], dtype=float32)

>>> F.leaky_relu(x, slope=0.2).data
array([[-0.2 , 0. ],
[ 2. , -0.60000002],
[-0.40000001, 1. ]], dtype=float32)