We proceed with the recipe as follows:
- Clone the code from github:
git clone https://github.com/TengdaHan/GAN-TensorFlow
- Define a Xavier initializer as defined in the paper Understanding the difficulty of training deep feedforward neural networks (2009) by Xavier Glorot, Yoshua Bengio. 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 tf.random_normal(shape=size, stddev=xavier_stddev) return xavier_stddev
- Define a convolutional operation for the given input x, weight w, bias b, and given stride. Our code uses the standard tf.nn.conv2d(...) module. Note that we use 'SAME' padding, as defined in Chapter 4:
def conv(x, ...