Assignment C3W3 how to calculate adversarial_loss

Hi,

In the UNQ_C2, it asked me to implement the gen_adversarial_loss, which from the slides and lecture, I believe it is the LeastSquaresLoss of disc_Y and the labels.

But in the exercise, I believe I should use torch.zeros_like as labels, because what I fed into disc_Y is generated Y, which is considered as fake_Y. And there is no real_Y provided hence I cannot do the mean.

But the unit test doesn’t take my result, and believe torch.ones_like should be used as label, which confused me.

Thanks!

When you compute the generator’s loss, the goal is to fool the discriminator into labeling the generator images as “real”. So it does sound like you want the labels to be ones_like in that case.

Of course the situation is always asymmetric: when we compute the discriminator loss on the generator images, then we use zeros_like as the labels.