Hi Ptrblck,
I am trying to update the discriminator by multiplying the coffecient to the all computed error. I used thsi code but it gives me the following error.I would apprecite your help.
        Param=0.2
        netD.zero_grad()
        images1=images1.unsqueeze(1)
        real_cpu = images1.to(device)
        b_size = real_cpu.size(0)
        label = torch.full((b_size,), real_label, device=device)
        label=label.to(device)
        netD=netD.float()
        output = netD(real_cpu).view(-1)
        
        errD_real = criterion(output, label)
## ------- Creating fake --------------
        noise = torch.randn(b_size, nz,1, 1, 1, device=device)
        netG=netG.float()
        fake = netG(noise).to(device)
        
## -----------------FakeFinal ---------------
        FakeFinal=torch.mul(fake,Negpach1)

        label.fill_(fake_label)
        label=label.to(device)
        output = netD(FakeFinal.detach()).view(-1)
        
        errD_fake = criterion(output, label)        
        eraDWhole=(1-Param)*(errD_fake+errD_real)

        eraDWhole.backward()


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