Detaching a sequence of tensors gives inplace modification error

I’m not sure what exactly might be causing the issue as it seems that D gets detached tensors and thus “Train Discriminator” shouldn’t update G.
Could you check, if any gradients are created in the “Train Discriminator” step or if the parameters or G were changed? I don’t know how the optmizer(s) were created but in case you are using an optimizer with running stats and are updating G already in the “Train Discriminator” step (even with zero gradients in G) you might be hitting this issue.