A couple items that are unclear to me in get_generator_block (and get_discriminator_block) and Generator:
In function get_generator_block (and get_disc_block), input_dim is scalar but in test_get_gen_block (and test_get_disc_block), it passes an array of feaures (num_test, in_features). How does it translate from a feature vector to a scalar?
How does it translate from num_test (# examples) to just one example?
Generator returns an image then why the last activation is Sigmoid?
![Posting codes that assess your grades is against community guidelines, kindly refrain from posting codes on public post
It is quite common to scale images by dividing the pixel values by 255, which gives you values between 0 and 1. Most image libraries will just handle that with no problem.
Neural Network models are always implemented using matrix multiplication, so the input can be a single example or a tensor with multiple input examples.
On the point about the discriminator block, I think you’re missing the fact that get_discriminator_block is a function that returns a function. The properties of the function it returns are not the same as the properties of the base function necessarily, right? You have to look at the actual logic. What is the function signature of the returned “block” function? Note that it is a torch Sequential object, the first layer of which is an instance of nn.Linear. Here is the docpage for torch Linear.