ReLU

Activation · node type · Relu, Clip

Passes positive values unchanged and sets negative ones to zero: the default nonlinearity.

Also called Rectified linear unit, ReLU6, Clip

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

ReLU is the simplest useful nonlinearity: below zero the output is zero, above zero it equals the input. It is cheap, its gradient does not shrink for positive inputs, and it makes many units exactly zero, so each input switches on a different subset of the network. Without a nonlinearity like this, a stack of dense layers would collapse into a single linear map. ReLU6 additionally caps the output at 6, which mobile networks use so activations stay in a predictable range. A unit whose input stays negative for every example outputs zero forever, a failure called a dead unit.

Formula

ReLU(x) = max(0, x)ReLU6(x) = min(max(0, x), 6)

Shapes and parameters

Shapes
Any shape in, the same shape out; applied element by element.
Parameters
None. An activation is a fixed function applied to every element, so it adds no parameters.
Used for
Hidden layers of MLPs and CNNs, every game NPC brain in WeightSpace, MobileNet (as ReLU6).

Figure 2. ReLU inside Drive a car out of a valley, a real model in WeightSpace. The 2 outlined nodes are ReLU; select any node for its shapes and parameters.

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

In WeightSpace

No parameters of its own. In the game NPC brains every hidden unit is a dense row followed by ReLU, and edits often work by moving a row’s bias across zero so the unit switches on or off for certain inputs.

Where it appears