ReLu is called as the Rectified Linear Unit.
Just like Sigmoid activation function and Tanh activation function, ReLU takes the raw logit and transforms it into something else. But unlike those two, it doesn’t squash anything into a bounded range.
- if z < 0 : then output is 0
- elif z > 0 : output is z

Since ReLU is defined piecewise, we differentiate each piece separately.
For : the function is just the constant . The derivative of a constant is always .
For : the function is . The derivative of with respect to is .
at z = 0 Relu is not defined, and so derivative also will be undefined. Hence there will be a sharp jump from 0 to 1 in the derivative graph.

So the derivative is either 0, or 1.
The advantages of this is that :
- There wont be any Vanishing Gradient effect.
- So when backprop is happening we are multiplying repeatedly with 1s, so learning is faster as it descends quickly in the gradient descent process.
- It is cheap to compute as computers are super fast at handling 0s and 1s, instead of computing or for every neuron like how Tanh and Sigmoid does.
One drawback of this activation function is that :
Once for everything, . Now look at the chain again:
The gradient itself is 0. So the weights never get updated, irrespective of the learning rate . So learning never happens
The clean summary of what you figured out
This problem is also called as the Dying Relu Problem. But with a proper setting of the learning rate this is less frequently an issue.
Thats why Leaky ReLu was introduced.