LeakyReLU
classkeras.layers.LeakyReLU(negative_slope=0.3, **kwargs)
泄漏版本的修正线性单元激活层.
该层允许在单元不活跃时有一个小的梯度.
公式:
f(x) = alpha * x if x < 0
f(x) = x if x >= 0
示例:
leaky_relu_layer = LeakyReLU(negative_slope=0.5)
input = np.array([-10, -5, 0.0, 5, 10])
result = leaky_relu_layer(input)
# result = [-5. , -2.5, 0. , 5. , 10.]
参数:
negative_slope: 浮点数 >= 0.0.负斜率系数.
默认为 0.3
.
**kwargs: 基础层的键值对参数,例如
name
和 dtype
.