← all repositories
Zardinality/WGAN-tensorflow

WGAN in TensorFlow: when the math works either way

A straightforward notebook implementation of Wasserstein GAN that lets you flip the loss signs and still trains, because duality is weird like that.

579 stars Jupyter Notebook Image · Video · AudioML Frameworks
WGAN-tensorflow
Velocity · 7d
+0.2
★ / day
Trend
steady
star history

What it does

Two Jupyter notebooks train and generate images from Wasserstein GANs on MNIST and SVHN, using TensorFlow 1.x. Data downloads automatically; you set parameters in the second cell and point TensorBoard at the logs. A second notebook handles generation from checkpoints.

The interesting bit

The author actually explains why the sign of your critic loss doesn’t matter—both fake - real and real - fake work because the Lipschitz constraint set is sign-symmetric. Most repos just copy one convention and hope; this one walks you through the duality substitution. There’s also an Improved-WGAN branch that the author admits they couldn’t get working properly.

Key highlights

  • Sticks to the original paper’s hyperparameters: learning rate 5e-5, 5 critic updates per generator step
  • Includes the PyTorch original’s heuristic of extra critic updates at start and every 500 steps
  • MLP generator variant included, though it converges slower to sharp images
  • GPU device selection via tf.device (defaults to gpu:0)
  • SVHN data loader borrowed from OpenAI’s improved-gan repo

Caveats

  • Locked to TensorFlow 1.0.0+ in an era where TF 1.x is effectively archived
  • Improved-WGAN (with gradient penalty) is present but broken: gradient norms sit near 1, so the squared-gradient regularizer misfires, and the author couldn’t debug why
  • All images in the README are dead Sina Weibo links—ironic for a generative image project

Verdict

Worth a look if you’re teaching or debugging WGAN fundamentals and want a clean, commented baseline with honest notes on what doesn’t work. Skip it if you need production TF 2.x code or a working Improved-WGAN implementation.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.