I am confused now having this error:
ValueError: Using a target size (torch.Size([5, 1])) that is different to the input size (torch.Size([5])) is deprecated. Please ensure they have the same size.
As some days ago this code run with no error at all. How is it possible?
The error happens in the following lines when I try to train my GAN
       # Train the Generator
        model.zero_grad()
        errG = criterion(fake, hr_img)

        out_Dis_G_1 = Dis(fake)
        print(out_Dis_G_1.shape)
        labels1 = torch.full((bsize, 1), 1, dtype=torch.float, device='cuda')
        **e_g = loss_clf(out_Dis_G_1, labels1)**

Although, when I have the similar lines above but about D model, there is no problem
labels0 = torch.full((bsize,1), 0, dtype=torch.float, device='cuda')

errDis_fake = loss_clf(out_Dis_G, labels0)