ReLU is an activation function that outputs the input unchanged when it is positive and outputs 0 when it is 0 or below. It is cheap to compute and lets networks train well even as they get deeper, so it is the standard first choice when you are unsure which activation function to use. The name stands for Rectified Linear Unit: like electrical rectification (letting current flow in only one direction), it passes only positive values.
The output range is . Concrete values look like this:
| Input | −2 | −0.5 | 0 | 1.5 | 3 |
|---|---|---|---|---|---|
| Output | 0 | 0 | 0 | 1.5 | 3 |
| Slope (derivative) | 0 | 0 | 0 * | 1 | 1 |
* The derivative is mathematically undefined at . Both the original paper (Nair and Hinton, 2010) and frameworks such as PyTorch treat the slope for as 0.
