Probably your number of samples is not not divisible by the batch_size without a remainder, which might yield a smaller number of samples for the last batch.
As you create real_labels using the batch_size you could have a size mismatch for the last batch:
real_labels = torch.ones(bs).view(-1,1,1,1)

You could just keep the code and get rid of the last (smaller) batch using drop_last=True in your DataLoader.
Alternatively, you could create your labels using the current number of samples in the batch instead of the global batch_size:
real_labels = torch.ones(images.size(0)).view(-1,1,1,1)