Missed TensorFlow World? Check out the recap. Learn more

nsl.estimator.add_adversarial_regularization

View source on GitHub

Adds adversarial regularization to a tf.estimator.Estimator.

nsl.estimator.add_adversarial_regularization(
    estimator,
    optimizer_fn=None,
    adv_config=None
)

Args:

  • estimator: An object of type tf.estimator.Estimator.
  • optimizer_fn: A function that accepts no arguments and returns an instance of tf.train.Optimizer.
  • adv_config: An instance of nsl.configs.AdvRegConfig that specifies various hyperparameters for adversarial regularization.

Returns:

A modified tf.estimator.Estimator object with adversarial regularization incorporated into its loss.