pytorch遇到的这个错误,其中存在的一种可能是类别数的问题,类别是1 ,模型里给classes的地方就给1
File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\modules\loss.py", line 529, in forward
return F.binary_cross_entropy(input, target, weight=self.weight, reduction=self.reduction)
File "C:\Users\Administrator\Anaconda3\lib\site-packages\torch\nn\functional.py", line 2477, in binary_cross_entropy
"!= input nelement ({})".format(target.numel(), input.numel()))
ValueError: Target and input must have the same number of elements. target nelement (262144) != input nelement (524288)