Adversarial training process in unconditional GANs

As we explained at the beginning of this chapter, the adversarial training process is where we alternate the execution of the training steps for the Discriminator and Generator. The Generator requires the value that's computed by the Discriminator to perform its parameter update, while the Discriminator requires the generated samples (also known as fake input) and the real samples.

TensorFlow allows us to define a custom training loop easily. The tf.GradientTape object, in particular, is extremely useful for computing the gradient of a specific model, even when there are two models interacting. In fact, thanks to the trainable_variables property of every Keras model, it is possible to compute ...

Get Hands-On Neural Networks with TensorFlow 2.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.