Skip to content
Tooling for GANs in TensorFlow
Jupyter Notebook Python Shell
Branch: master
Clone or download
joel-shor and Copybara-Service Simplify mnist test.
PiperOrigin-RevId: 269655833
Change-Id: I6dead9e0c72a76fed15282120d5d27141e0e3b59
Latest commit cee6ad6 Sep 17, 2019

TensorFlow-GAN (TF-GAN)

TF-GAN is a lightweight library for training and evaluating Generative Adversarial Networks (GANs).

Structure of the TF-GAN Library

TF-GAN is composed of several parts, which are designed to exist independently:

  • Core: the main infrastructure needed to train a GAN. Set up training with any combination of TF-GAN library calls, custom-code, native TF code, and other frameworks
  • Features: common GAN operations and normalization techniques, such as instance normalization and conditioning.
  • Losses: losses and penalties, such as the Wasserstein loss, gradient penalty, mutual information penalty, etc.
  • Evaluation: standard GAN evaluation metrics. Use Inception Score, Frechet Distance, or Kernel Distance with a pretrained Inception network to evaluate your unconditional generative model. You can also use your own pretrained classifier for more specific performance numbers, or use other methods for evaluating conditional generative models.
  • Examples: simple examples on how to use TF-GAN, and more complicated state-of-the-art examples

Who uses TF-GAN?

Numerous projects inside Google. The following are some published papers that use TF-GAN:

The framework Compare GAN uses TF-GAN, especially the evaluation metrics. Their papers use TF-GAN to ensure consistent and comparable evaluation metrics. Some of those papers are:

Training a GAN model

Training in TF-GAN typically consists of the following steps:

  1. Specify the input to your networks.
  2. Set up your generator and discriminator using a GANModel.
  3. Specify your loss using a GANLoss.
  4. Create your train ops using a GANTrainOps.
  5. Run your train ops.

At each stage, you can either use TF-GAN's convenience functions, or you can perform the step manually for fine-grained control.

There are various types of GAN setup. For instance, you can train a generator to sample unconditionally from a learned distribution, or you can condition on extra information such as a class label. TF-GAN is compatible with many setups, and we demonstrate in the well-tested examples directory



You can’t perform that action at this time.