If the question is about the step method of the learning rate scheduler (in this case StepLR), then you should also call the schedulers’ step method, which is different from that of the optimizers.
Since you say that they have joint training, it might be preferable to use one optimizer with the parameters from both nets, but keep separate lr schedulers as you did, then call
net1_lr_scheduler.step()
net2_lr_scheduler.step()
as necessary (i.e. at each epoch or iteration, depending on how you want to count them. See the example here, which does not include the optimizer step call!
However, I can’t see how the schedules are different for both nets, by reading your code, since they have the same step size, gamma, and original learning rate. Did I misunderstand something?
Thanks. I was mistake when copy paste. Actually, the first net used betas=(0.5, 0.999) while the second net use betas=(0.9, 0.999). That is reason why I used two seperated scheduler