You could use the functional API in the forward pass via:
def forward(self, x, p):
    ...
    x = F.dropout(x, p, training=self.training)
    ...

Note that you should pass the self.training attribute to this layer so that this dropout call will be disabled, if you call model.eval().