Instead of having one loss function and one optimizer for both your discriminator and generator, you could have a loss and optimizer for each of them. This means your training loop would look something like this:
for i in range(NUM_ITERATIONS):
    loss_gen = ...
    loss_gen.backward()
    optim_gen.step()

    if i % 100 == 0:
        loss_disc = ...
        loss_disc.backward()
        optim_disc.step()


Hope this helps!