How it works...
In step 1, we defined the shape of the input image and the number of channels. Since the images that we used were grayscale, we specified the channels as 1. We also defined the latent space dimension, which is used as the input for the generator. In step 2, we constructed a generator network. The goal of the generator is to produce images from the random normal vectors of the latent_dim dimension. It generates an output tensor of 784 dimensions. We used a deep neural network as the generator network in our example. Note that we used tanh as the activation function in the last layer of the generator since it performs better than the sigmoid activation function. Also, Leaky ReLU was used as the activation function in the hidden ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access