Should I reset the hidden and cell states of my LSTMs each time I use the generator and discriminator in my GAN?

Hi,

I’m trying to build a GAN with both the generator and the discriminator composed of LSTM networks. I’ve created a function to initialise the hidden and cell states of both networks. However, I am confused as to when and how often these hidden and cell states need to be initialised during the training iterations.

For example, I first train my discriminator with fake data. To do this, I use the generator to generate fake data and the discriminator to classify it as real or fake. To use both of these, I initialise the hidden and cell states of both the disxriminator and the generator.

Next, I need to train the discriminator with real data. Here, I use real data and feed it to the discriminator for classification. Do I need to reset the hidden state of the discriminator now as they have been trained for the fake data in the first step?

Finally, I train my generator. Once again, I generate noise data and feed it into the generator. As the generator has already been used, do the hidden and cell states need to be reset at this point? Similarly for the discriminator internal states as it has been used twice now?

Any help on this would be greatly appreciated!

Thanks,

Anne Marie