I followed the tutorial in the document to run the program,but all four methods in Reconstruct Single Data encounter the same error.
_RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retaingraph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.
As described above, This error occurs after the local iteration is complete. Then I checked the code and found the following code in GradientInversion_Attackline306
distance.backward(retain_graph=False)
I don't know if retain_gragph=False is the core cause of this bug, but I really don't have a better solution right now.
I followed the tutorial in the document to run the program,but all four methods in Reconstruct Single Data encounter the same error.
_RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors after they have already been freed). Saved intermediate values of the graph are freed when you call .backward() or autograd.grad(). Specify retaingraph=True if you need to backward through the graph a second time or if you need to access saved tensors after calling backward.
As described above, This error occurs after the local iteration is complete. Then I checked the code and found the following code in GradientInversion_Attack line306
distance.backward(retain_graph=False)
I don't know if retain_gragph=False is the core cause of this bug, but I really don't have a better solution right now.