Leaky ReLU

Activation · node type · LeakyRelu, PRelu, Elu

Like ReLU, but negative inputs keep a small slope, so units never go completely silent.

Also called PReLU, ELU, Parametric ReLU

Move the input and compare activation functions. The gradient is what training sees: where it is flat, learning stalls.
-4-224-22

f(1.00) = 1.000

Figure 1. Try it: every number is computed in your browser from the formula below.

What it does

Leaky ReLU multiplies negative inputs by a small constant, often 0.01 or 0.2, instead of zeroing them. A unit that is pushed below zero still passes a weak signal and gradient, which avoids dead units and helps adversarial training in GAN discriminators. PReLU learns the negative slope per channel. ELU bends smoothly toward a constant −α for very negative inputs, which keeps mean activations closer to zero.

Formula

LeakyReLU(x) = x if x ≥ 0, otherwise α·xPReLU(x) = x if x ≥ 0, otherwise ac·x (ac learned per channel)ELU(x) = x if x ≥ 0, otherwise α·(ex − 1)

Shapes and parameters

Shapes
Any shape in, the same shape out. PReLU’s slope tensor broadcasts over channels.
Parameters
None for Leaky ReLU and ELU. PReLU has one learned slope per channel: 64 for a 64-channel layer.
Used for
GAN discriminators, some face and detection networks (often as PReLU), super-resolution models.

Figure 2. Leaky ReLU inside Read a facial expression, a real model in WeightSpace. The 33 outlined nodes are Leaky ReLU; select any node for its shapes and parameters.

Figure 3. The typed ports of Leaky ReLU, in the same format as every model drawing. Letters such as N or C stand for any size.

In WeightSpace

Read-only in WeightSpace today: there is nothing learned inside it. When an edit moves a bias in the layer before it, this function decides how much of that shift reaches the next layer, so its shape explains why some edits flip an answer and others barely move it.