nnzhan / MTGNN

MIT License
761 stars 216 forks source link

A question about tensors #22

Open 1018594417 opened 3 years ago

1018594417 commented 3 years ago

Dear Author , I admire your project but when I was running your code , I met an error and I can't solve it . I build the environment as your instruction and tried to run the traffic dataset. It trace back like this: Traceback (most recent call last): File "train_single_step.py", line 218, in val_acc, val_rae, val_corr, test_acc, test_rae, test_corr = main() File "train_single_step.py", line 178, in main train_loss = train(Data, Data.train[0], Data.train[1], model, criterion, optim, args.batch_size) File "train_single_step.py", line 77, in train tx = X[:, :, id, :] IndexError: tensors used as indices must be long, byte or bool tensors. Do you know how to debug it ? Looking forward to your reply,Thank you very much!

nnzhan commented 3 years ago

Can you provide the script you run the code?

owl-j commented 3 years ago

Hi, I am having the same issue when running it on the electricity dataset. The command we ran was:

python train_single_step.py --save ./model-electricity-3.pt --data ./data/electricity.txt --num_nodes 321 --batch_size 4 --epochs 30 --horizon 3 --device cuda:0

priodyuti commented 2 years ago

tensors used Please add id = id.long() before tx = X[:, :, id, :], I hope it will resolve the problem.