tamarott / SinGAN

Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
https://tamarott.github.io/SinGAN.htm
Other
3.3k stars 612 forks source link

torch version issue, please suggest #152

Closed vishals2911 closed 3 years ago

vishals2911 commented 3 years ago

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [3, 32, 3, 3]] is at version 2; expected version 1 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

gulzainali98 commented 3 years ago

which version did you use?

Bella722 commented 2 years ago

try add this line in singan/trainning.py line229

        errG = -output.mean()
        errG.detach_().requires_grad_(True)  #add this line
        errG.backward(retain_graph=True)
        if alpha!=0: