I changed my loss function to
nn.BCELoss()

Now iam getting
  "please use transforms.Resize instead.")
C:\Users\anesh\Anaconda3\envs\virtual_platform\lib\site-packages\torch\nn\functional.py:1189: UserWarning: Using a target size (torch.Size([1])) that is different to the input size (torch.Size([15])) is deprecated. Please ensure they have the same size.
  "Please ensure they have the same size.".format(target.size(), input.size()))
Traceback (most recent call last):

  File "<ipython-input-1-7e0b4c8bc7b1>", line 115, in <module>
    errD_real = criterion(output, target)

  File "C:\Users\anesh\Anaconda3\envs\virtual_platform\lib\site-packages\torch\nn\modules\module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)

  File "C:\Users\anesh\Anaconda3\envs\virtual_platform\lib\site-packages\torch\nn\modules\loss.py", line 430, in forward
    size_average=self.size_average)

  File "C:\Users\anesh\Anaconda3\envs\virtual_platform\lib\site-packages\torch\nn\functional.py", line 1192, in binary_cross_entropy
    "!= input nelement ({})".format(target.nelement(), input.nelement()))

ValueError: Target and input must have the same number of elements. target nelement (1) != input nelement (15)

Iam new to pytorch.I chose pytorch over tensorflow bcoz I love pytorch.Please help me solve this error.Iam doing GAN with pytorcch.