Solved by rasbt in post #2 
              
              
                Is your error something along the lines of? 
RuntimeError: Trying to backward through the graph a second time ...

? 
That’s because the graph gets deleted after it’s been evaluated via .backward(). If you want to backpropate through the graph a second time. You can set the argument "retain_graph=Tr…