leaky_relu

dragon.nn.leaky_relu(
  inputs,
  alpha=0.2,
  **kwargs
)[source]

Apply the leaky rectified linear unit.

The LeakyReLU function is defined as:

\[\text{LeakyReLU}(x) = \begin{cases} x, & \text{ if } x \geq 0 \\ \alpha * x, & \text{ otherwise } \end{cases} \]

Examples:

x = dragon.constant([-1, 0, 1], 'float32')
print(dragon.nn.leaky_relu(x, inplace=False))
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • alpha (number, optional, default=0.2) – The value of \(\alpha\).
Returns:

dragon.Tensor – The output tensor.