How to do it...

We proceed with the recipe as follows:

  1. Clone the code from github:
git clone https://github.com/TengdaHan/GAN-TensorFlow
  1. Define a Xavier initializer as described in the paper Understanding the difficulty of training deep feedforward neural networks (2009) by Xavier Glorot, Yoshua Bengio, http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.207.2059&rep=rep1&type=pdf  The initializers are proven to allow better convergence for GANs:
def xavier_init(size):  in_dim = size[0]  xavier_stddev = 1. / tf.sqrt(in_dim / 2.)  return xavier_stddev
  1. Define the generator for the input X. First we define a matrix W1 with the dimension [100, K=128], initialized according to a normal distribution. Note that 100 is an arbitrary value for ...

Get TensorFlow 1.x Deep Learning Cookbook 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.