Assignment - Reference for discriminator loss

Following the slides, to compute the discriminator loss in get_disc_loss, I added up:

  • the loss for the discriminator predictions on the real images, and
  • the loss for the discriminator predictions on the fake images.

However, this was off by a factor of 2. Can someone point me towards the correct formula for the discriminator loss?

Here’s what they say in that section:


Discriminator Loss

First, you’re going to be implementing the discriminator loss. This is the same as in previous assignments, so it should be a breeze :slight_smile: Don’t forget to detach your generator!


Well, the fact that it was twice the value should be suggestive :smiley:: in the previous assignments the discriminator loss is the average of the two losses (on the real and fake images), all the way back to the first assignment in C1 W1. Here’s the relevant entry in the docstring for get_disc_loss in the C1 W1 Your First GAN assignment:

    #       4) Calculate the discriminator's loss by averaging the real and fake loss
    #            and set it to disc_loss.
1 Like