In a GAN-based model, contains one generator model and three discriminator model, all the models are wrapped in torch.nn.parallel.DistributedDataParallel() with different argument process_group, the loss function contains two parts, like this:
d_total_loss = d_real_loss + d_fake_loss
and the backpropgation is : d_total_loss.backward()
when I run the program, the error is:
image2008×335 25.5 KB
But, when I run d_real_loss.backward() or d_fake_loss.backward(), the program could run normally.
What’s more, I have another problem that is when I use generator_model.train() in my program and run it, there will be an error:
image2018×507 29.5 KB
Could you give me some advice to solve these problems?