when changing the polarities dim to 2, I met the problem.
Traceback (most recent call last):
File "train.py", line 303, in
main()
File "train.py", line 299, in main
ins.run()
File "train.py", line 176, in run
best_model_path = self._train(criterion, optimizer, train_data_loader, val_data_loader)
File "train.py", line 110, in _train
loss = criterion(outputs, targets)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py", line 962, in forward
ignore_index=self.ignore_index, reduction=self.reduction)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2468, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2264, in nll_loss
ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
IndexError: Target 2 is out of bounds.
when changing the polarities dim to 2, I met the problem.
Traceback (most recent call last): File "train.py", line 303, in
main()
File "train.py", line 299, in main
ins.run()
File "train.py", line 176, in run
best_model_path = self._train(criterion, optimizer, train_data_loader, val_data_loader)
File "train.py", line 110, in _train
loss = criterion(outputs, targets)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/module.py", line 727, in _call_impl
result = self.forward(*input, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/loss.py", line 962, in forward
ignore_index=self.ignore_index, reduction=self.reduction)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2468, in cross_entropy
return nll_loss(log_softmax(input, 1), target, weight, None, ignore_index, None, reduction)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/functional.py", line 2264, in nll_loss
ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
IndexError: Target 2 is out of bounds.