RuntimeError: stack expects each tensor to be equal size, but got [2] at entry 0 and [2, 2] at entry 7 #88
-
Hi Lambeq support, I am trying to train a binary classification model using my own dataset, i am using the classic pipeline example in lambeq documentation and when i pass train_dataset to trainer.fit() of PytorchTrainer it throws this error: RuntimeError: stack expects each tensor to be equal size, but got [2] at entry 0 and [2, 2] at entry 7. I am using BobcatParser for sentences to diagram and SpiderAnsatz for circuits. Thanks a lot for help |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Hi, it seems that not all of your diagrams have the same output wires, you can try to restrict the output of the parser by using the |
Beta Was this translation helpful? Give feedback.
I see, these are imperative sentences, the type of which is usually
n.r s
(i.e. 2 wires in the output) and this is what causes the problem. You have these options:s
wire. This should be done at the string diagram level, i.e. before converting to circuits.I hope this helps, let us know if not.