Week1 : Programming assignment

how come hidden_dim =128 ?
like im_dim=28*28.

also what is get_generator_block why multiplying sometimes by 2,4,8 to hidden_dim

Hi @starboy

hidden dimension=128 means that your generator’s first hidden layer has 128 neurons (right after the input layer) and likewise the other dimensions will be calculated accordingly. It’s up to you to choose this value as it is a hyperparameter. For this notebook, the only thing you have to take care of is that your network’s output dimension is 784 because in the method show_tensor_images(image_tensor, num_images=25, size=(1, 28, 28)) the size of image tensor is (1,28,28).

The get_generator_block method is helping you to build the generator’s network architecture block by block. You can print the gen variable after initializing the Generator class to print its architecture. Refer to the screenshot to know where exactly you can print it.

The multiplication of 2, 4, 8 is done to increase the number of neurons in the hidden layers. Again, these numbers are hyperparameters, and you can tweak them as per your choice. You can check the screenshot again to identify how the number of hidden layers dimensions is increasing (10, 128, 256, 512, and goes on).

NOTE: Try not to change any variable unless stated otherwise as the grader might not be able to follow your code while submission. Create a new copy of your notebook and then play around with it

3 Likes

More on get_generator_blockget gen

1 Like