The function
compute_discriminator is the one I wrote before the loop for the training.
The function compute_generator_loss is independent, as the error occurs only when I add genFeat_loss into the sum
                generator_loss = loss_1 + loss_2 + loss_2 + genFeat_loss
If I remove this from the sum, I don’t get any error.
The function self.compute_genFeatLoss is a simple mathematical formula
loss_G_GAN_Feat = 0
for j in range(len(fake_features)):
      loss_G_GAN_Feat += self.computeL1Loss(fake_features[j], true_features[j].detach())