The MNIST Generator

Learn about defining the MNIST generator class.

Let’s now turn our attention to the generator, which will be more interesting.

The MNIST generator class

We want the generator to create images of the same format as those in the MNIST dataset. That is 784 pixel values for 28 by 28 images.

Reversing the discriminator’s neural network is a good starting point. That gives us a network with an output layer of 784 nodes, a hidden layer of 200 nodes, and an input later of 1 node. The following picture shows the generator and discriminator networks next to each other. We can see clearly how the generator’s output of 784 pixel values is precisely what the discriminator expects as input.

Get hands-on with 1400+ tech skills courses.