No, you shouldn’t use the .data attribute, as it might yield silent errors and could break your code in various ways.
The error message points to a mismatch between a tensor and the expected nn.Parameter.
Try to wrap the new weight into a parameter via:
with torch.no_grad():
    self.conv.weight = nn.Parameter(self.conv.weight * self.filter_mask)

Also, since self.filter_mask is used in a no_grad() block only, I assume it won’t be trained and can thus be registered as a buffer via:
self.register_buffer('filter_mask', filter_mask)