Apply inverted dropout to activations x during training. Draw a keep-mask with np.random.default_rng(seed).random(x.shape) < keep_prob, zero out the dropped entries, and divide the survivors by keep_prob so the expected value of each activation is unchanged.
Implement solve(x, keep_prob, seed=0).
Returns. Return a NumPy array with the shape of x. keep_prob must lie in (0,1], otherwise ValueError is raised; keep_prob=1 returns x unchanged.
Example 1
Input:
solve([1.0, 2.0, 3.0, 4.0], 0.5, 0)
Output:
[0.0, 4.0, 6.0, 8.0]
Example 2
Input:
solve([1.0, 2.0, 3.0], 1.0, 0)
Output:
[1.0, 2.0, 3.0]
Example 3
Input:
solve([1.0, 2.0], 0.0, 0)
Output: Raises ValueError.
No results yet
Run your code to check it against the examples, or submit to run every test.