The ELU activation function — the Exponential Linear Unit — behaves like ReLU for positive inputs but replaces the flat negative region with a smooth exponential curve. That negative saturation pushes a layer’s mean activation toward zero and, like Leaky ReLU, prevents dead neurons. This guide covers the ELU activation function’s formula, why it helps, ELU versus Leaky ReLU, and Python code.

Try it: interactive ELU plot
The blue curve is the ELU activation function with α = 1; unlike Leaky ReLU’s straight negative line, ELU curves smoothly to a floor of −α.
The ELU activation function formula
The ELU activation function — Exponential Linear Unit — behaves like ReLU for positive inputs but replaces the flat negative region with a smooth exponential curve that saturates at −α (usually α = 1).
Why the negative saturation helps
ELU vs Leaky ReLU
Both fix dying ReLU, but they treat negatives differently. Leaky ReLU uses a straight line with slope α that keeps decreasing forever; the ELU activation function uses a curve that flattens to −α. ELU’s smoothness and saturation often train a touch better, at the cost of an exponential per negative input.
ELU activation function in Python
import numpy as np
def elu(x, alpha=1.0):
return np.where(x > 0, x, alpha * (np.exp(x) - 1))
print(elu(np.array([-2.0, -0.5, 2.0])))
# [-0.865 -0.393 2. ]In Keras: tf.keras.layers.ELU(alpha=1.0). Background is in the ELU paper.
Tuning notes
The single hyperparameter controls how deep the negative saturation goes; the default of one works well across most tasks and rarely needs changing. A closely related scaled variant, SELU, fixes the constants so that activations self-normalise toward zero mean and unit variance from layer to layer, which can remove the need for explicit normalisation in carefully constructed feed-forward networks. As always, the smooth negative branch costs an exponential per unit, so it is worth benchmarking against a plain rectifier before committing on a latency-sensitive model. In practice the choice between the smooth exponential curve and a straight leaky slope is rarely decisive; both keep neurons alive, and the larger accuracy gains almost always come from data, architecture and regularisation rather than from swapping one negative-side shape for another.
Related activation functions
- Activation Functions — the complete guide (hub).
- Leaky ReLU — the straight-line rival.
- ReLU — the cheaper baseline.
- GELU — the transformer choice.