C1W2 Assertion error

I am getting Assertion error in UNQ_C2:
image
What does it mean? Is the code successful?

This error means that your generator output’s shape is not as expected. You need to revise you generator model and pay special attention to the last layer.

Right! Anytime an assertion fails, that means there is a problem. So in this case, as Gent says, the output shape is wrong. So the first question is “ok, what shape is it?”

print(gen_output.shape)

Then the next question is “how did it get that way?” That’s how debugging works, right? One step at a time starting from the error message. :nerd_face:

If this is your first encounter with the assert statement in python, it would be worth having a look at some documentation. Google “python assert” and you’ll get lots of good hits. They use that technique all over the place in the GANs specialization as a way to implement “unit tests” for your code.

1 Like