For example, I want to explicitly multiply 2 on the convolution layers’ weight.
I motify the official conv.py.py from :
def forward(self, input):
return self._conv_forward(input, self.weight)
to
def forward(self, input):
new_weight = self.weight * torch.ones(self.weight.size())*2
return self._conv_forward(input, new_weight)
I noticed that the type of new_weight
becomes torch.Tensor
rather than torch.nn.parameter.Parameter
.
So I wonder whether it’s OK to do this? And can the backward process works correctly?
@albanD
Thanks in advance!