if your code goes like this:
images = torch.cat(images)
output = netD(images)

It will work.
Also you can have a look at the example of DCGAN

  
      github.com
  
  
    pytorch/examples/blob/master/dcgan/main.py#L228-L237

D_x = output.data.mean()


# train with fake
noise.resize_(batch_size, nz, 1, 1).normal_(0, 1)
noisev = Variable(noise)
fake = netG(noisev)
labelv = Variable(label.fill_(fake_label))
output = netD(fake.detach())
errD_fake = criterion(output, labelv)
errD_fake.backward()