I am doing the following :
criterion(input,target)
Both being variable but I end up with the following error which I am not understanding :
File “grad_cam.py”, line 93, in
loss = criterion(input, target)
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/nn/modules/module.py”, line 202, in call
result = self.forward(*input, **kwargs)
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/nn/modules/loss.py”, line 316, in forward
self.weight, self.size_average)
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/nn/functional.py”, line 452, in cross_entropy
return nll_loss(log_softmax(input), target, weight, size_average)
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/nn/functional.py”, line 367, in log_softmax
return _functions.thnn.LogSoftmax()(input)
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/nn/_functions/thnn/auto.py”, line 110, in forward
self._backend = type2backend[type(input)]
File “/home/lelouedec/.local/lib/python2.7/site-packages/torch/_thnn/init.py”, line 15, in getitem
return self.backends[name].load()
KeyError: <class ‘torch.LongTensor’