The MeanShift Conv2d you defined in your code won't freeze, there is no requires_grad attribute in Conv2d module. You should freeze it using self.weight.requires_grad=False and self.bias.requires_grad=False instead, rather than self.requires_grad=False.
However, change MeanShift Conv2d to below will be more clear and more correct. The code is following here
The
MeanShift Conv2d
you defined in your code won't freeze, there is norequires_grad
attribute inConv2d
module. You should freeze it usingself.weight.requires_grad=False
andself.bias.requires_grad=False
instead, rather thanself.requires_grad=False
. However, changeMeanShift Conv2d
to below will be more clear and more correct. The code is following here