Hi. I am trying conditional GAN code. The following error comes up when I run the code:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [1, 512, 4, 4]] is at version 3; expected version 2 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!
The solution I found on the discussion forums is to detach fake and real samples.
I cannot understand where exactly should I place .detach() or if it is actually the solution to problem. I tried placing it at some places within the code but the error is still there. Any suggestion will be highly appreciated.