Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A question about tensors #22

Open
1018594417 opened this issue Mar 4, 2021 · 3 comments
Open

A question about tensors #22

1018594417 opened this issue Mar 4, 2021 · 3 comments

Comments

@1018594417
Copy link

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
Copy link
Owner

nnzhan commented Mar 12, 2021

Can you provide the script you run the code?

@owl-j
Copy link

owl-j commented May 12, 2021

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants