According to:
  
    
    
    Model.zero_grad() or optimizer.zero_grad()? 
  
  
    Hi everyone, 
I have confusion when to use model.zero_grad() and optimizer.zero_grad()? I have seen some examples they are using model.zero_grad() in some examples and optimizer.zero_grad() in some other example. Is there any specific case for using any one of these?
  


model.zero_grad() and optimizer.zero_grad() are the same IF all your model parameters are in that optimizer..

In which situation the model parameters will not be in the optimizer ?
Can you give me an example of this situation ?