Find a region with zero ReLU gradient
Read a complete operation before typing its result. · 187 words
The ReLU function is ReLU(z) = max(0, z). For z < 0, its output stays at zero while its input changes, so its derivative is zero. For z > 0, its derivative is one. At z = 0, the ordinary derivative is undefined, although many frameworks choose zero there. Take y = ReLU(2x - 3). The negative region is 2x - 3 < 0, which simplifies to x < 1.5. Thus, dy/dx = 0 for every x < 1.5. For example, x = 1 produces z = -1 and y = 0.
A second network shows how a zero-gradient region can pass through later layers. Let h = ReLU(3x - 1), z = 2h + 1, and y = ReLU(z). Because h is always nonnegative, z is always at least 1, so the final ReLU is always active. The first ReLU supplies the only possible zero factor. When x < 1/3, h = 0 and dh/dx = 0, making dy/dx = 0. When x > 1/3, the derivative is 1 times 2 times 3, or 6. At x = 1/3, the first ReLU is at its corner.
Check your recall
For y = ReLU(2x - 3), what is the zero-gradient region?
Check your answer
The gradient is zero when 2x - 3 < 0, so x < 1.5. At x = 1.5 the mathematical derivative is undefined, although a common ReLU implementation reports zero there.
Sources and credits
Original KeyTouch lesson. Background reading · Google · Neural networks.