In resnet18, I wanted to simply replace ‘fc’ final layer, something like:
model.fc = nn.Linear(512,10)
Now if I wanted to do:
param_groups = [
    {'params':model.fc.parameters(),'lr':.001},
    {'params':model.others.parameters(),'lr':.0001},
]
optimizer = Adam(param_groups)

Finding model.others.parameters() part seemed hard. I could probably replace it with params array below:
params = []
for child in list(model.children())[:-1]:
    params.extend(list(child.parameters()))

Or define a class overriding nn.Module, which I did in the end. I was just wondering if there’s any elegant one liner, nothing big deal Thanks.