Initialize specific index of a Parameter to zero with mask

I have a parameter named P with size n*n and I want to initialize the parameter with positive values. On the other hand, I have a mask which shows which indices of P are parameters and which indices are not.
I have used the following code but I’ve got an error:

self.P.data.uniform_(0, stdv)
self.P = self.P * self.mask

Is there any way I can do it?