I call detach before passing fake_images into the discriminator:
output = discriminator(fake_images.detach()).view(-1)

I’m also using torch.no_grad(), so I don’t think it should be necessary anyways, but I’m not 100% sure about that.