Join us at TensorFlow World, Oct 28-31. Use code TF20 for 20% off select passes. Register now

tf.contrib.gan.features.clip_discriminator_weights

View source on GitHub

Modifies an optimizer so it clips weights to a certain value.

tf.contrib.gan.features.clip_discriminator_weights(
    optimizer,
    model,
    weight_clip
)

Args:

  • optimizer: An optimizer to perform variable weight clipping.
  • model: A GANModel namedtuple.
  • weight_clip: Positive python float to clip discriminator weights. Used to enforce a K-lipschitz condition, which is useful for some GAN training schemes (ex WGAN: https://arxiv.org/pdf/1701.07875).

Returns:

An optimizer to perform weight clipping after updates.

Raises:

  • ValueError: If weight_clip is less than 0.