I asked the same question a few days ago.

  
    
    
    What exactly does `retain_variables=True` in `loss.backward()` do? 
  
  
    It is essentially the same, retain_variables argument has been deprecated in favor of retain_graph.