Hi,
The dropout function already exists in the functional interface of nn (at least in master, not sure for older releases) as dropout(input, p=0.5, training=False, inplace=False).
That being said, the dropout function is not différentiable wrt the p parameter, so you won’t get a gradients for this, just for input.