Closed yuzhiguo07 closed 3 years ago
Hi, I tried on my machine and it worked just fine. What version of PyTorch are you using?
I got the same error with pytorch==1.6.0
It works just fine for me with PyTorch 1.6.0. Are you sure your tags
is of dtype long?
Thanks! Float tensor found. It works after I changed tags' dtype to long
Great! Glad that you got it working. I'm closing this issue.
I just follow the example in the document, but I got this error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/opt/conda/lib/python3.6/site-packages/torchcrf/__init__.py", line 102, in forward numerator = self._compute_score(emissions, tags, mask) File "/opt/conda/lib/python3.6/site-packages/torchcrf/__init__.py", line 187, in _compute_score score += emissions[0, torch.arange(batch_size), tags[0]] RuntimeError: tensors used as indices must be long or byte tensors
code: