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

IndexError #3

Closed
WeeshawChen opened this issue May 12, 2020 · 2 comments
Closed

IndexError #3

WeeshawChen opened this issue May 12, 2020 · 2 comments

Comments

@WeeshawChen
Copy link

At first, I want to use my own dataset, it came across an error,
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
I found it in trainer.py
I thought it was the dataset problem, so I used the office31 as the training dataset, but still got the same problem
IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number
would you please tell me if there is something wrong with my confs?

image

@huitangtang
Copy link
Collaborator

huitangtang commented May 12, 2020 via email

@WeeshawChen
Copy link
Author

WeeshawChen commented May 12, 2020

Well, thanks for your instant replying.
I googled it before you reply,
NVIDIA/flownet2-pytorch#113
Just as you said, it is caused by the PyTorch version but I still don't get it that how to change the code here
I am not sure the image can be shown here.
image

So here is the code from trainer.py
for i in range(batch_size): total_vector[target[i]] += 1 #torch.LongTensor([target[i]]) type: torch,Tensor, value: tensor([92]) #correct[i] type:torch.Tensor,value: tensor(0.) correct_vector[torch.LongTensor([target[i]])] += correct[i]

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

2 participants