WGAN assignment UNQ_C4

In the get_crit_loss function , if I define the critic loss as

crit_loss = ( crit_real_pred.mean() - crit_fake_pred.mean() ) + (c_lambda * gp)
which is according to the min(g) max(c) equation, I get assertion error

whereas if I interchange the first 2 terms as
crit_fake_pred.mean() - crit_real_pred.mean()
I get success.

Could somebody please explain me the reason ?

2 Likes

When you change the order of a subtraction, you’re also changing the sign of the result.

1 Like

So, that’s why when we train the model we get generator loss as positive and critic loss as negative ?
Any specific reason why we are doing this ?

1 Like

Sorry, not a mentor for that course. I just gave some mathematical explanation for the difference between a-b and b-a.

Hi @Prasanna_Hegde, this is exaclty what it is the minmax game.

The minimax game involves optimizing two opposing objectives:

  1. Generator Loss: The generator tries to minimize the likelihood of the discriminator correctly classifying its generated samples as fake.
  2. Discriminator Loss: The discriminator aims to maximize its ability to correctly classify real and generated samples.