I am facing the following error:
RuntimeError: Trying to backward through the graph a second time, but the buffers have already been freed. Specify retain_graph=True when calling backward the first time.

I am 90% percent sure this is because that I have some variables are used across different batches without being detached. Can I pinpoint those variables by looking at the computation graph using tensorboard? If so, what parameters should I pass to add_graph()?