Implement the class DropoutLayer(p) with methods forward(x, training=True) and backward(grad) for NumPy arrays of any shape.
__init__ stores self.p (drop probability, ; raise ValueError otherwise) and sets self.mask = None.forward with training=True: draw a fresh mask with exactly one call np.random.binomial(1, 1 - p, x.shape) (1 = keep, 0 = drop), store it in self.mask, and return (inverted-dropout scaling).forward with training=False: return x unchanged and leave self.mask untouched.backward(grad): return using the mask from the most recent training forward pass; raise ValueError if no mask has been generated yet.Tests seed the global generator with np.random.seed(...) before calling the layer, so the expected numbers depend on the exact binomial call above and on one draw per training forward pass.