Complete the code to define the noise input shape for the GAN generator.
noise_shape = ([1],)The noise input to the GAN generator is usually a vector of length 100, representing random latent space input.
Complete the code to compile the GAN generator model with the Adam optimizer.
generator.compile(optimizer=[1], loss='binary_crossentropy')
The Adam optimizer is commonly used for GAN training because it adapts learning rates and converges well.
Fix the error in the discriminator training step by completing the code to train on real images.
d_loss_real = discriminator.train_on_batch(real_images, [1])Real images are labeled with ones (1) to indicate they are real during discriminator training.
Fill both blanks to generate fake images and label them for discriminator training.
noise = np.random.normal(0, 1, (batch_size, [1])) fake_labels = np.[2]((batch_size, 1))
Noise vector length is 100. Fake images are labeled with zeros (0) for discriminator training.
Fill all three blanks to create a dictionary of losses for GAN training metrics.
losses = {'d_loss_real': d_loss_real, 'd_loss_fake': d_loss_fake, '[1]': g_loss}
print(f"Discriminator real loss: {losses['d_loss_real']}")
print(f"Discriminator fake loss: {losses['d_loss_fake']}")
print(f"[2] loss: {losses['[3]']}")The generator loss key is 'g_loss'. The printed label is 'Generator'. The dictionary key used in print is 'g_loss'.