jiamings / wgan

Tensorflow Implementation of Wasserstein GAN (and Improved version in wgan_v2)
240 stars 82 forks source link

Is it wrong for tf.reduce_sum(tf.square(ddx), axis=1)? #9

Closed uuutty closed 6 years ago

uuutty commented 6 years ago

@jiamings In your wgan-v2.py, you write ddx = tf.sqrt(tf.reduce_sum(tf.square(ddx), axis=1)) this will result a shape (50, 64, 64, 3) to (50, 64, 3) in tensorflow 1.6.0. If I understand right for the paper Improved Training of Wasserstein GANs, this should be ddx = tf.sqrt(tf.reduce_sum(tf.square(ddx), axis=[1,2,3])) which get a shape of (50,) indicate the batch size.

jiamings commented 6 years ago

Not if you assume the shape is [batch, x_dim] which is always the case for my examples. I do reshape to image space within the network.