The order of param_group in optim.param_groups

Hi experts, I am new to Pytorch. I am fine tuning ResNet50 model using my own dataset. At first, I optimize only paramaters in “layer4” block + fc layer by passing only these parameters to SGD(). After several epochs, I want to optimize parameters in “layer3” + “layer4” + fc. Notice that I add “layer3” block. I accomplish this using optim.add_param_group(). So, now parameters of “layer3” come AFTER “layer4” block and fc in optim.param_groups().

My question is whether the order of param_group in optim.param_groups matter?Thank you.

No, the order doesn’t matter, since all param_groups will be sequentially updated as seen here.