`.detach()` cannot stop backprop in `training_step`

Thanks a lot. the message is really helpful.

I have also tried to update discriminator multiple times and update generator one times in one training step, by configuring the same optimizer multiple times, like this

def configure_optimizers(self):
    opt_d = ...
    opt_g = ...
    return [opt_d] * self.hparams.k + [opt_g], []

This trick just stops training, possibly for the same reason.

But such situation could be common in GAN or other type of networks, while any walking around makes code (just the training part :slight_smile:) harder to write and read than plain pytorch.

So is there a flag or something to turn off this behavior of lightning, so that my code can look more ‘lightning’?