W1C1 UNQ_C7: assertion throwing

Hi, I am feeling stuck at this point because I can not to find which is the issue. The following is my code in the get_gen_loss function:

{moderator edit - solution code removed}

It is simple, but I got an “error” in the assert:
—> 21 assert torch.all(torch.abs(gen_loss_tensor - 1) < 1e-5)

Could anyone help me, please? Which is the problem in the code?

Hi @carlosmera20 ,

Welcome to the community! This is your first post :slight_smile:

Regarding your error, please read again the rule on the loss calculation:

“Remember the generator wants the discriminator to think that its fake images are real”

Right now you are passing zeros_like… may be try passing an argument that makes the discriminator think that the fakes are real.

Please try that and let me know how it goes.


Hello @Juan_Olano,

Thank You!