MTGNN icon indicating copy to clipboard operation
MTGNN copied to clipboard

A question about tensors

Open 1018594417 opened this issue 3 years ago • 3 comments

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!

1018594417 avatar Mar 04 '21 07:03 1018594417

Can you provide the script you run the code?

nnzhan avatar Mar 12 '21 01:03 nnzhan

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

owl-j avatar May 12 '21 06:05 owl-j

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

priodyuti avatar Sep 18 '21 09:09 priodyuti