y = y.long() does the job. There are similar methods for other data types, such as int , char , float and byte . ... <看更多>
Search
Search
y = y.long() does the job. There are similar methods for other data types, such as int , char , float and byte . ... <看更多>
For FloatTensor , you can do math operations (multiplication, addition, division etc.) with a scalar of type int or float . But for LongTensor , ... ... <看更多>
LongTensor([18])) / 0.0625 # Floating point exception (core dumped) torch. ... the divisor as Long and it triggers integer division by zero. ... <看更多>
It seems you need to pass a 1D LongTensor for the target. In your sample code, you passed a float value. I changed your sample code to work ... ... <看更多>
float /long error when training. ... De: "Ben Trevett" [email protected] À: "bentrevett/pytorch-pos-tagging" [email protected] ... ... <看更多>