In order to train GAN using training loop, you can use "dlarray" and "dlnetwork" for automatic differentiation.
Here is the code for your reference:
Output:-
The loss of discriminator "Loss D" , starts higher but decreases as the model learns.
Similarly the loss of generator "Loss G", increases as the model learns.
Hence this is how you can structure training loops for GANs training.