Module: tf.contrib.gan

Defined in tensorflow/contrib/gan/

TFGAN is a lightweight library for training and evaluating GANs.

In addition to providing the infrastructure for easily training and evaluating GANS, this library contains modules for a TFGAN-backed Estimator, evaluation metrics, features (such as virtual batch normalization), and losses. Please see for details and usage.


estimator module: TFGAN estimator module.

eval module: TFGAN evaluation module.

features module: TFGAN features module.

losses module: TFGAN losses and penalties.


class ACGANModel: An ACGANModel contains all the pieces needed for ACGAN training.

class CycleGANLoss: CycleGANLoss contains the losses for CycleGANModel.

class CycleGANModel: An CycleGANModel contains all the pieces needed for CycleGAN training.

class GANLoss: GANLoss contains the generator and discriminator losses.

class GANModel: A GANModel contains all the pieces needed for GAN training.

class GANTrainOps: GANTrainOps contains the training ops.

class GANTrainSteps: Contains configuration for the GAN Training.

class InfoGANModel: An InfoGANModel contains all the pieces needed for InfoGAN training.

class RunTrainOpsHook: A hook to run train ops a fixed number of times.

class StarGANModel: A StarGANModel contains all the pieces needed for StarGAN training.


acgan_model(...): Returns an ACGANModel contains all the pieces needed for ACGAN training.

cyclegan_loss(...): Returns the losses for a CycleGANModel.

cyclegan_model(...): Returns a CycleGAN model outputs and variables.

gan_loss(...): Returns losses necessary to train generator and discriminator.

gan_model(...): Returns GAN model outputs and variables.

gan_train(...): A wrapper around that uses GAN hooks.

gan_train_ops(...): Returns GAN train ops.

get_joint_train_hooks(...): Returns a hooks function for joint GAN training.

get_sequential_train_hooks(...): Returns a hooks function for sequential GAN training.

get_sequential_train_steps(...): Returns a thin wrapper around slim.learning.train_step, for GANs.

infogan_model(...): Returns an InfoGAN model outputs and variables.

stargan_loss(...): StarGAN Loss.

stargan_model(...): Returns a StarGAN model outputs and variables.