How to understand 'calling .backward() clears the computation graph'

See the answer here:

If retain_graph=False, intermediate outputs needed for the backwards computation are freed. If there are no saved intermediate outputs, (like in the case of addition) then subsequent calls may still work, but you should not rely on that behavior.

1 Like