Ok, maybe my answer lacked a bit of context:
Here is how I understood your question: you want to have a way to have a dropout layer on the weight for a given layer. So for a layer that would do output = f(input, weight), you want a dropout layer such that you get output = f(input, dropout(weight)).
Given that the only layer that you use that has parameters in your code is a nn.Linear, that is why I used that in my example.
Given the current implementation of nn.Linear, the simplest way to apply dropout on the weights is by creating a new class as in my first answer that I will call MyLinear.
Then to use it, you simply replace self.fc1 = nn.Linear(input_size, hidden_size) by self.fc1 = MyLinear(input_size, hidden_size, dropout_p). That way, when you call out = self.fc1(x) later, the dropout will be applied within the forward call of self.fc1.
To be more precise on the forward function implemented above, it is basically implementing a linear layer for which the weight matrix has gone through a dropout layer before.
To do so, it first forwards the original weights in the dropout layer (that I called self.masker because you can see applying dropout as masking part of the matrix), then it uses these weights, that went through the dropout layer, and do what a regular linear layer would do, as you can see here 10 in the original nn.Linear implementation.