I am designing a Generative Adversarial Network (GAN) trained on an image dataset. It has two components: the generator and the discriminator. The generative network outputs an artificial image. The discriminator takes that both real and artificial images and tells whether they are artificial or real.

The real images have the size, say, 30x30. The output of the generative network is 29x29. How do I reconcile the two when feeding them to the discriminator?

  1. Do I pad one side with zeros or shave off a row and a column from the original images?

  2. Do I design a generative network that outputs exactly 30x30 images? This will constrain the architecture I can use.

  3. Do I resize the original dataset to 29x29?

How do I reconcile different output sizes for loss computation and training when comparing generated and real examples?

  • $\begingroup$ 1) padding with zeros should be incredibly easy for the discriminator to detect 2) Indeed, the type of data we have constrains our generator (in many ways). This is what I would do. 3) this would be fine too. $\endgroup$ Nov 19, 2022 at 15:17

1 Answer 1


I dont know why it would constraint you. But I think what you really need to do is to modify the structure of generator, maybe some parameters. If you build it with pytorch or tensorflow you can refer to relative code on github or learn to use arcitecture proposed in DCGAN


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.