We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Activations step 4 of 9
Easy
Primitives
Implement Leaky ReLU
Implement the Leaky ReLU activation function.
$$\text{LeakyReLU}(x) = \begin{cases} x & \text{if } x > 0 \\ \alpha x & \text{if } x \leq 0 \end{cases}$$
where $\alpha$ is a small positive constant (default 0.01).
Input: A tensor x and a scalar alpha (default 0.01)
Output: A tensor of the same shape
Loading visualization…
Nothing accepted yet. When a submission passes, the code that passed shows up
here, one entry per mode.
Stuck?
PyTorch reference solution
Sign in to attempt this problem and reveal the reference solution.