**ReLU** (Rectified Linear Unit) is the most common activation in deep networks. **Leaky ReLU** fixes the "dying ReLU" problem by allowing a small negative gradient.
relu(x) = max(0, x)leaky_relu(x, alpha=0.01) = x if x > 0 else alpha * xrelu([-2, -1, 0, 1, 2]) → [0, 0, 0, 1, 2] leaky_relu([-2, 0, 2]) → [-0.02, 0, 2]
Similar Problems
Test Cases (2 visible · 2 hidden)
Case 1: Basic ReLU
Input: relu([-2,-1,0,1,2])
Expected: [0, 0, 0, 1, 2]
Case 2: Leaky ReLU default alpha
Input: leaky_relu([-2,0,2])
Expected: [-0.02, 0, 2]
⌘↵ Run · ⌘⇧↵ Submit