UNQ_C2 function get_gen_loss

Hi, I have tried multiple times but could not pass the third and forth test cases. I strictly followed the instructions but something went wrong. Here is my code.

START CODE HERE

{moderator edit - solution code removed}

END CODE HERE

I’m struggling… Can someone lend a helping hand?

Hi Caixinlei!
I hope that you are doing well. Well, to be honest, I cannot and I’m not supposed to give you the correct code. But I can point out where you are going wrong.
I guess you didn’t check/read the description of the parameters given in the function properly or carefully.

It says this for “adversarial criterion” and “reconstruction criterion” parameters::

adv_criterion: the adversarial loss function; takes the discriminator
predictions and the true labels and returns an adversarial
loss (which you aim to minimize
recon_criterion: the reconstruction loss function; takes the generator
outputs and the real images and returns a reconstruction
loss (which you aim to minimize)

Now please check the parameters that you have passed to the recon_criterion function. You have passed the real/fake prediction matrix returned from the generator and real images whereas the correct parameters should be the generator’s output and the real images.
Also, this assignment belongs to week 2 (C3W2B Assignment) so I have modified the tag too.

Have a great day. Happy Learning.
Regards,
Nithin

I also stuck on this cell. I can’t figure out what is the true labels? How can I get these true labels? Please give some hints. Thanks

@Hannah_Xu1, I think from this other thread that you figured this out. Is that right? It’s working for you now?