For example ,when we create an optimizer like this:
optimizer_ft=optim.SGD(model_ft.parameters(),lr=0.001,momentum=0.9)
we will  add  the model’s  parameters to  this  optimizer,so when we call the function   optimizer.zero_grad()   it  will update  these  parameters ,but if  there is another  model  which  did’t register  this optimizer,   optimizer.zero_grad()    will  not update   it’s    grad