AgeProgression icon indicating copy to clipboard operation
AgeProgression copied to clipboard

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation

Open CherryChou98 opened this issue 3 years ago • 3 comments

Has anyone ever encountered with this error? I'd appreciate it so much if you have any solutions. RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1024, 100]], which is output 0 of TBackward, is at version 2; expected version 1 instead. Hint: the backtrace further above shows the operation that failed to compute its gradient. The variable in question was changed in there or anywhere later. Good luck!

CherryChou98 avatar Oct 18 '21 13:10 CherryChou98

me too

lgl1227 avatar Jan 22 '22 13:01 lgl1227

fix it by modifying the following code: d_z_prior = self.Dz(z_prior.detach()) d_z = selfDz(z.detach()).

The solution came from here:https://github.com/pytorch/pytorch/issues/39141

MengyunQ avatar Feb 09 '22 15:02 MengyunQ

The solution did not help, is there anything else I could try

Ussatsov avatar Apr 03 '23 17:04 Ussatsov