NumPy allowed · plain Python earns 10 bonus points
Apply inverted dropout regularization during training to prevent co-adaptation of feature representations.
Implement dropout_forward(x, p_drop, mask): given activations x, dropout probability p_drop, and binary keep-mask mask (where 1 means keep, 0 means drop), compute out[i][j] = (x[i][j] * mask[i][j]) / (1.0 - p_drop). Scaling during training ensures that no scaling is required at test time. Round each element to 4 decimal places.
dropout_forward(x: list[list[float]], p_drop: float, mask: list[list[int]]) -> list[list[float]]