Week 2 Assignment assertion error


I am getting following assertion error for discriminator, I have not changed any of the parameters and while calling the ConvTranspose2d or batchnorm I am just passing the parameters directly received in function call, not sure why I am getting this error.

Thank you.


Hi Sairam!
The assertion error is because of the wrong shape of the hidden_output. If you have implemented the correct layers and passed the correct parameters then it wouldn’t be happening. From your query, I get to know that you are using the ConvTranspose2d layer in the Discriminator block which is wrong. The discriminator is a normal CNN involving Conv2d layers where you have image inputs. We are not trying to generate an image from noise using ConvTranspose2d like in the case of the generator.
Have a great day.

1 Like

Hi there,

May I get some help with another assertion error please, if lines 11 and 12 are commented seems like theres no problem.

Hi Diego!
Welcome to the community :dizzy:
Hope you are doing well. Sorry for the late response.
Your hidden output seems fine, i.e. but the final output is wrong. There are two blocks in the test cells → test_hidden_block and test_final_block. Both call the make_gen_block of the Generator but the difference is that test_final_block sets the final_layer parameter as True . This in turn goes to the else part of make_gen_block. Thus, you might be doing some mistakes in the else part of make_gen_block. Please, check if you have used the correct layer type and activation function in the else part.