# leaky_relu¶

paddle.fluid.layers.nn. leaky_relu ( x, alpha=0.02, name=None ) [source]

Warning: API “paddle.fluid.layers.nn.leaky_relu” is deprecated since 2.0.0, and will be removed in future versions. Please use “paddle.nn.functional.leaky_relu” instead.

LeakyRelu Activation Operator.

$$out = \max(x, \alpha * x)$$

Args:

x(Variable): A LoDTensor or Tensor representing preactivation values. Must be one of the following types: float32, float64 alpha(FLOAT|0.02): Slope of the activation function at x < 0 name(str|None): The default value is None. Normally there is no need for user to set this property. For more information, please refer to Name

Returns:

output(Variable): A LoDTensor or Tensor with the same type and size as that of x

Examples:

import paddle

x = paddle.to_tensor([[-1, 2], [3, -4]], dtype='float32')
y = paddle.fluid.layers.leaky_relu(x, alpha=0.1)
print(y) # [[-0.1, 2], [3, -0.4]]