Rafael_Valle:

I have some main function that runs forward, backward on models that I want to adapt such that I can use one model file for a GAN framework (two models: discriminator and generator).


You’re supposed to run them in two different steps. First the generator runs, then the discriminator. Something like
for phase in ['generator','discriminator']:
    if phase == 'generator':
        generator.train()
    else:
        discriminator.train()

In code, this is very much like training a supervised framework where you run steps for training and validation.