@Megh_Bhalerao, It gives the same error.
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 ‘target’ in call to _thnn_nll_loss2d_forward
Would the error come from the model?
loss = criterion(output.float(), target.float())
Traceback (most recent call last):
File “”, line 1, in
loss = criterion(output.float(), target.float())
File “C:\Anaconda3\envs\envTorch\lib\site-packages\torch\nn\modules\module.py”, line 541, in call
result = self.forward(*input, **kwargs)
File “C:\Anaconda3\envs\envTorch\lib\site-packages\torch\nn\modules\loss.py”, line 916, in forward
ignore_index=self.ignore_index, reduction=self.reduction)
File “C:\Anaconda3\envs\envTorch\lib\site-packages\torch\nn\functional.py”, line 2009, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File “C:\Anaconda3\envs\envTorch\lib\site-packages\torch\nn\functional.py”, line 1840, in nll_loss
ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: Expected object of scalar type Long but got scalar type Float for argument #2 ‘target’ in call to _thnn_nll_loss2d_forward
log_softmax,
the last activation function in the model is a nn.Sigmoid(), no a nn.Softmax(), it could be?