How to use LSTM to construct GAN?

My code is as following:

The first image is generator(G) and the second is discriminator(D). I want use G to generate data for every time step and use D to classify the real data and the generated data. I’m not sure whether I code correctly or not. And I don’t know about the red underline section why ‘lstm_out[-1]’ in D and ‘lstm_out’ in G?

Good morning,
I want to use LSTM to construct the generator and the discriminator.
Does it work for you ? Get you any response?

Thanks in advance