We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
← Normalization step 5 of 6
Medium
Primitives
Implement Dropout
Implement the Dropout regularization technique.
During training, randomly zero out elements with probability $p$ and scale the remaining elements by $\frac{1}{1-p}$:
$$y_i = \frac{x_i \cdot m_i}{1 - p}$$
where $m_i \sim \text{Bernoulli}(1 - p)$ is a binary mask.
For this problem, you are given the binary mask directly.
Input:
-
x: input tensor of any shape -
mask: binary tensor of the same shape (1 = keep, 0 = drop) -
p: dropout probability (fraction of elements to drop)
Output: Tensor with dropout applied and properly scaled
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.