W-Net-PyTorch icon indicating copy to clipboard operation
W-Net-PyTorch copied to clipboard

ValueError: Using a target size (torch.Size([46])) that is different to the input size (torch.Size([46, 1])) is deprecated. Please ensure they have the same size.

Open zhenzi0322 opened this issue 3 years ago • 1 comments

zhenzi0322 avatar Nov 11 '21 06:11 zhenzi0322

Traceback (most recent call last): File "main.py", line 71, in trainer.train_one_epoch(epoch) File "/home//W-Net-PyTorch/src/trainer.py", line 96, in train_one_epoch cls_enc_s, File "/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/W-Net-PyTorch/src/loss_func.py", line 116, in forward out[0], real_label.float() File "/home/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, **kwargs) File "/home/pytorch/lib/python3.6/site-packages/torch/nn/modules/loss.py", line 613, in forward return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction) File "/home//pytorch/lib/python3.6/site-packages/torch/nn/functional.py", line 2752, in binary_cross_entropy "Please ensure they have the same size.".format(target.size(), input.size()) ValueError: Using a target size (torch.Size([64])) that is different to the input size (torch.Size([64, 1])) is deprecated. Please ensure they have the same size.

同问

Note-Liu avatar Apr 29 '22 06:04 Note-Liu