Solved by albanD in post #5 
              
              
                Hi, 
I don’t think this is what he wants. 
retain_graph can be used if you want to call backward() multiple times on the same graph. 
create_graph is used if you want to backward() through the backward(). But since this second backward() will go through the current graph, then retain_graph has to be…