Simple GAN with TensorFlow

You can follow along with the code in the Jupyter notebook ch-14a_SimpleGAN.

For building the GAN with TensorFlow, we build three networks, two discriminator models, and one generator model with the following steps:

  1. Start by adding the hyper-parameters for defining the network:
# graph hyperparametersg_learning_rate = 0.00001d_learning_rate = 0.01n_x = 784  # number of pixels in the MNIST image # number of hidden layers for generator and discriminatorg_n_layers = 3d_n_layers = 1# neurons in each hidden layerg_n_neurons = [256, 512, 1024]d_n_neurons = [256]# define parameter ditionaryd_params = {}g_params = {}activation = tf.nn.leaky_reluw_initializer = tf.glorot_uniform_initializerb_initializer = tf.zeros_initializer ...

Get Python: Advanced Guide to Artificial Intelligence 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.