You are detaching the loss tensors by wrapping them into the deprecated Variable in:
D_loss = Variable((D_fake_loss + D_real_loss)/2, requires_grad=True)

so you should remove the Variable usage.
(Note that the same issue would be caused, if you rewrap the loss in a new tensor.)
Also, if you are training the discriminator, you usually don’t want to calculate any gradients for the generator, so you would most likely want to detach() the generator output before feeding it to D.
The DCGAN tutorial 2 shows a good usage of a GAN training.