Why do not use shuffle when training discriminator in GAN

I’am learning GAN recently with book GANs in Action and other programs on the Internet. And I jsut learned how to use GAN to generator mnist number. However, I noticed that neither the book nor other programs used shuffle when training discriminator(figure1). So I tried using shuffle, but the outcome was poor, almost was noise(figure2&3). And I increased the interation, the outcome using shuffle imporved, but it took a lot more time and even still worse than not using shuffle. I was told using shuffle dataset will accelerate the model to find better parameters, but why it was at opposite when training GAN?
VZBKIK07{MN)Z%0S)_N4M
figure1:this is keras code, but the result was same using pytorch

I can’t comment on the Keras code, but the PyTorch DCGAN example uses shuffle=True in the DataLoader setup.

Yes. But that just shuffles mnist number 1-9, but does not shuffle real images and fake images when training discriminator. Real images and fake images are sent to discriminator successively, not collectively and randomly. That is to say we send a batch of real images to discriminator, and then send another batch of fake images to it, why can’t we just send a batch of shuffled real images and fake images together when training discriminator (this turned out a poor results)?

Thanks for clarifying the question.
I believe that’s one of the “GAN hacks” as e.g. described by @smth in here.
While the repository is ~5 years old by now and also contains this warning:

(this list is no longer maintained, and I am not sure how relevant it is in 2020)

it still seems to be relevant :wink:

Thank you very much for answering. Now I know it’s neccessary to use two batches of data. But it seems no one has proven this, maybe it’s kind of hard math problem :joy:.

Additionally, also take a look at the corresponding talk by Soumith at Neurips 2016. Note that GAN training indeed moved in the last couple of years and I’m sure there are more and/or other “hacks” now to let these types of models work, so you might also want to check the recent literature/talks.