Course 3 week 1 Assignement: UNQ_C1

Hi,
please I need your help. can’t figure out why this chunk of code is not working. I followed the instruction and my code is row-wise.

    target_images = fake
    quest = torch.randn(len(real)) > p_real
    target_images[quest] = real[quest]


Thank you

The issue was solved and I was able to complete the assignment.

Hi @GuyMerf,
As a hint - since the test is checking if the ratio is right, take a look at your line

quest = torch.randn(len(real)) > p_real

What would this give you if p_real is 0 (meaning you want no reals)? What would it give you if p_real is 1 (meaning you want all reals)? Is this what you’ll get in your next line of code with your current implementation?
Another thing you can try is to print out quest to see if the ratio looks right. Then think about what you need to change to fix it.

Once you fix that issue, I see another thing you’ll run into with your current code. Take a look at the “Optional Hints” - in particular the point about using clone() :wink:

Good luck!

2 Likes

Oops. Somehow overlooked your note that you’d figured this out! Congratulations! :raised_hands:

1 Like