Dropout is random, so a single forward pass is noisy. The paper's key claim is that the average over many dropout masks behaves like the un-dropped network with the right scaling. This question checks that claim numerically.
Implement dropout_expectation(x, p, n_samples, rng) that draws n_samples masks, applies inverted dropout to each, and returns the mean.
rng is a numpy.random.Generator.n_samples is a positive integer.Draw all masks at once with rng.random((n_samples,) + x.shape) >= p, then average over axis 0.
No results yet
Run your code to check it against the examples, or submit to run every test.