Closed AdolHong closed 6 years ago
I am sorry, maybe such change cannot fix my error..
because I found that my model cannot be optimized, loss become larger and larger ...
but I can not check out how I meet such error
@AdolHong Hi. Thank you for reporting!
It's weird that you have that "not contiguous" error. Could you please open an issue and post a minimal example to reproduce the error? As for the loss getting larger, note that pytorch-crf forward method computes the log likelihood, not the negative log likelihood, which is what you want as the loss. Are you sure you're already taking the negative? Again, this is probably better discussed in a separate issue. I am closing this PR for now.
File "/Applications/bin/anaconda3/lib/python3.6/site-packages/torchcrf/init.py", line 113, in forward numerator = self._compute_joint_llh(emissions, tags, mask) File "/Applications/bin/anaconda3/lib/python3.6/site-packages/torchcrf/init.py", line 187, in _compute_joint_llh llh += emissions[i].gather(1, cur_tag.view(-1, 1)).squeeze(1) * mask[i] RuntimeError: invalid argument 1: input is not contiguous at /Users/soumith/code/builder/wheel/pytorch-src/torch/lib/TH/generic/THTensor.c:231
and I fix the bug under the suggestion by @apaszke , more details see link: https://discuss.pytorch.org/t/runtimeerror-input-is-not-contiguous/930