Activation Function

A function applied to a neuron’s input to produce its output. Nonlinear activation functions help neural networks learn complex patterns.

What does a ReLU do to these four inputs?

A neuron combines its inputs into a number. A rectified linear unit, or ReLU, then returns the larger of zero and that number. The table applies the same rule to four sample values.

Input to the activationReLU output
−30
−0.50
00
22

Why put a bend in the rule?

The positive side preserves differences between positive inputs. The negative side collapses its inputs to zero. Stacking ordinary affine transformations without nonlinear activations would still give an affine transformation. Nonlinear activations allow a network to represent different behavior in different input regions.

A navy rail lies flat and then rises on a pale base.
Compare the flat and rising regions with the exact ReLU values in the table.

What should you infer from a zero?

In this example, zero tells you the input to this ReLU was zero or negative. It cannot recover which negative value arrived. Other activations behave differently: a sigmoid maps a real input between zero and one. Its use and interpretation depend on where it sits in the model.

Follow the idea

Deep Learning · Place an activation between learned transformations.

Backpropagation · See how derivatives influence parameter updates.

Source · PyTorch reference for the ReLU function

Return to Activation Function in the A–Z glossary