Hi,
Please check my sampler code as follows.
my questions are:


self.mask = self.mask_weight*temp, by this line, could I keep self.mask_weght and self.mask are in the same memory? will they be upated in sync?
why could I not be able to  self.mask_weight = self.mask_weight * temp  to re-assign the parameter?
does it mean that nn.parameter could only be defined once, and could not be re-defined?

class SMConv2d(nn.Module):
    def __init__(self, in_channels, out_channels, kernel_size, padding=1, stride=1):
        super(SMConv2d, self).__init__()
    
        self.mask_weight = nn.Parameter(torch.Tensor(out_channels, in_channels, kernel_size, kernel_size))
        nn.init.constant_(self.mask_weight, 1)
    
    def compute_mask(self,temp):
        self.mask = self.mask_weight*temp
        # self.mask_weight = self.mask_weight * temp
       
        return self.mask 

    def forward(self, x, temp=1):
        masked_weight = self.compute_mask(temp)
        out = F.conv2d(x, masked_weight, stride=self.stride, padding=self.padding)        
        return out