GANs-in-Action / gans-in-action

Companion repository to GANs in Action: Deep learning with Generative Adversarial Networks
1.01k stars 420 forks source link

Is it an error when train the generator in Chapter7 SGAN ? #6

Closed WendyMin closed 4 years ago

WendyMin commented 4 years ago

The original code is:

# Train Generator
        g_loss = gan.train_on_batch(z, np.ones((batch_size, 1)))

But the generator generates fake images, so I think the input of gan.train_on_batch is fake=np.zeros((batch_size, 1))

# Train Generator
        g_loss = gan.train_on_batch(z, np.zeros((batch_size, 1)))
youngsend commented 4 years ago

The original code is correct, because during Generator training, we want to fool the Discriminator.

WendyMin commented 4 years ago

Thanks. You are absolutely right.