求助:(Pytorch)resnet加载预训练好的模型finetune时conv、bn层权重均不更新,为什么呢?

在resnet先进行了预训练后,根据预训练权重进行剪枝,再加载剪枝后模型及权重后,对模型进行finetune时,发现conv、bn层的权重均没有更新。尝试改变学习率后对结果没有影响。

p.requires_grad: True
net.stage_1[0].bn_a.track_running_stats: True
net.stage_1[0].bn_a.training: False

上面的情况,finetune与train时都一致,没有变化。

finetune代码与train代码其实没有什么区别,只不过一个前者加载了个模型而已,为什么后者可以正常更新权重,前者却不可以?还可能是什么原因呢?

https://blog.csdn.net/qq_35091353/article/details/108237184