techtree / Glue math

Nonlinearity (ReLU)

Clip negatives to zero, entry by entry; the bend that makes layers useful.

42 seconds

ReLU(x)={xx>00otherwise\text{ReLU}(x) = \begin{cases} x & x > 0 \\ 0 & \text{otherwise} \end{cases}
Transcript

Here is a very simple function. If a number is negative, make it zero. Otherwise, leave it alone.

Three stays three. Minus two becomes zero. Zero stays zero.

Draw it as a graph. Flat along zero on the left, and a straight ramp on the right.

Two straight pieces, joined by one bend. So the whole thing is not a straight line.

It is called ReLU.

On a vector, it works on each entry by itself. Two stays two. Minus one becomes zero. One half stays. Minus three becomes zero.

Negatives become zero. Everything else passes through.