Closed ghost closed 6 years ago
Hi @charleyFeng , I am not sure about where the problem is based on this simple error message. If you use the correct data input, I guess the problem may be caused by the version of PyTorch. Please make sure you use the PyTorch 0.3.0
If you are using right version, then further debug is needed.
My torch version is 0.3.1.post2.
Then you may seperate the error sentence into several lines to see where does this error message come from (I guess it comes from function cat or view). Then for the error function, you may check its input shape and output shape to see if they are compatible
Ok,Thank you,I will check what you have mentioned,and if any result,I will post here.
I just add one line partition = partition.view(partition.size()[0], partition.size()[1], 1)
in function _viterbi_decode
in the for loop,now it can run,thank you very much.
cool!
partition = partition.unsqueeze(-1)
works also.
partition = partition.unsqueeze(-1)
works also.
Your method is not working.
Hi sir, I'm student learning ML/DL. Today, I got a same error msg from my torch code. Could you plz tell me what's the code file belongs to this issue?
Hi,Thank you for this perfect code,and I have learned a lot from this code.But when I run this code,I get one problem :
Traceback (most recent call last): File "main.py", line 438, in <module> train(data, save_model_dir, seg) File "main.py", line 265, in train batch_charrecover, batch_label, mask) File "/Users/fengxiachong/Desktop/PyTorchSeqLabel-master/model/bilstmcrf.py", line 33, in neg_log_likelihood_loss scores, tag_seq = self.crf._viterbi_decode(outs, mask) File "/Users/fengxiachong/Desktop/PyTorchSeqLabel-master/model/crf.py", line 162, in _viterbi_decode partition_history = torch.cat(partition_history).view(seq_len, batch_size, -1).transpose(1, RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 3 and 2 at /Users/soumith/minicondabuild3/conda-bld/pytorch_1518371252923/work/torch/lib/TH/generic/THTensorMath.c:2888
could you please help me?