The official GAN, the loss_dis does not affect the generator, since the generator has its own loss (loss_gen) which should be used for updating the generator. But, if you want to do it the other way on purpose, then you can leave the .detach(), and include the list of parameters of G in the optimizers defined for discriminator.