LeakyReLU¶
LeakyReLU 激活层,创建一个可调用对象以计算输入 x 的 LeakReLU 。
LeakyReLU(x)={x,if x>=0negative_slope∗x,otherwise
其中,x 为输入的 Tensor。
形状¶
input:任意形状的 Tensor。
output:和 input 具有相同形状的 Tensor。
代码示例¶
>>> import paddle
>>> m = paddle.nn.LeakyReLU()
>>> x = paddle.to_tensor([-2.0, 0, 1])
>>> out = m(x)
>>> print(out)
Tensor(shape=[3], dtype=float32, place=Place(cpu), stop_gradient=True,
[-0.02000000, 0. , 1. ])