Hi @ptrblck,
Thanks for you solution, it’s a good way to freeze some weights. However, if I set weight_decay or momentum in optim.SGD, you method will not work appropriately. Like
optimizer = optim.SGD(model.parameters(), lr=1.0,momentem=0.9, weighe_decay=0.001)

I have the same goal as Jan. I was wondering if you could tell me how to solve this problem.