Training the model

Now, it's time to train the model and see how the generator will be able to fool, to some extent, the discriminator, by generating images very close to the original CelebA dataset.

But first, let's define a helper function that will display some generated images by the generator:

# define a function to visualize some generated images from the generatordef show_generator_output(sess, num_images, input_latent_z, output_channel_dim, img_mode):    cmap = None if img_mode == 'RGB' else 'gray'    latent_space_z_dim = input_latent_z.get_shape().as_list()[-1]    examples_z = np.random.uniform(-1, 1, size=[num_images, latent_space_z_dim])    examples =        generator(input_latent_z, output_channel_dim, False),        feed_dict={input_latent_z: ...

Get Deep Learning By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.