Now that we've assembled both the generator and the discriminator, we need to assemble a third model that is the stack of both models together that we can use for training the generator given the discriminator loss.
To do that we can just create a new model, this time using the previous models as layers in the new model, as shown in the following code:
discriminator = build_discriminator(img_shape=(28, 28, 1))generator = build_generator()z = Input(shape=(100,))img = generator(z)discriminator.trainable = Falsereal = discriminator(img)combined = Model(z, real)
Notice that we're setting the discriminator's training attribute to False before building the model. This means that for this model we will not be updating ...