赞
踩
- File "C:\Users\Rain\AppData\Local\Programs\Python\Anaconda.3.5.1\envs\python35\python35\lib\site-packages\torch\nn\modules\module.py", line 491, in __call__
- result = self.forward(*input, **kwargs)
- File "C:\Users\Rain\AppData\Local\Programs\Python\Anaconda.3.5.1\envs\python35\python35\lib\site-packages\torch\nn\modules\loss.py", line 500, in forward
- reduce=self.reduce)
-
- File "C:\Users\Rain\AppData\Local\Programs\Python\Anaconda.3.5.1\envs\python35\python35\lib\site-packages\torch\nn\functional.py", line 1514, in binary_cross_entropy_with_logits
-
- raise ValueError("Target size ({}) must be the same as input size ({})".format(target.size(), input.size()))
-
- ValueError: Target size (torch.Size([32])) must be the same as input size (torch.Size([32,2]))
input 和 target 尺寸不匹配
将target转为onehot
例如:
one_hot = torch.nn.functional.one_hot(masks, num_classes=args.num_classes)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。