I think it’s fine,


loss.backward calculate grad

optimizer.step update param by something like w-=lr*grad
I think they are independent.

an example of multi-optimizer

  
      github.com
  
  
    pytorch/examples/blob/master/dcgan/main.py#L206-L207 96

optimizerD = optim.Adam(netD.parameters(), lr=opt.lr, betas=(opt.beta1, 0.999))
optimizerG = optim.Adam(netG.parameters(), lr=opt.lr, betas=(opt.beta1, 0.999))