sonoisa / code2vec

an implementation of "code2vec: Learning Distributed Representations of Code"
MIT License
29 stars 11 forks source link

Error in code #3

Open HaseebLUMS opened 5 years ago

HaseebLUMS commented 5 years ago

File "main.py", line 344, in subtoken_match exp_subtokens = label_vocab.itosubtokens[expected.item()] AttributeError: 'int' object has no attribute 'item'

sonoisa commented 5 years ago

@HaseebLUMS

Did you use pytorch 0.4? If so, could you use pytorch 1.1? I checked with 1.1.

lyyXiDian commented 4 years ago

My pytorch is 1.1.0 cpu-only and python is 3.6.10, the program also has this issues !

lyyXiDian commented 4 years ago

main.py-->subtoken_match(): exp_subtokens = label_vocab.itosubtokens[expected.item()] actual_subtokens = label_vocab.itosubtokens[actual.item()] is fault.

The right codes is : exp_subtokens = label_vocab.itosubtokens[expected] actual_subtokens = label_vocab.itosubtokens[actual]