Skip to content
New issue

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

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

Already on GitHub? # to your account

IndexError: Dimension out of range(expected to be in range of [-1, 0], but got 1) #2

Open
hyuan1991 opened this issue Aug 18, 2021 · 2 comments

Comments

@hyuan1991
Copy link

Hey, I got this error when I was trying to fine tune on CIFAR 10 dataset.
I got the same error when I was trying to fine tune on my own dataset.

Anyone got the same error?

Thanks

@JIABI
Copy link

JIABI commented Dec 6, 2021

Hey, I got this error when I was trying to fine tune on CIFAR 10 dataset. I got the same error when I was trying to fine tune on my own dataset.

Anyone got the same error?

Thanks

Change two places:
(1) line 193:
import torch.nn.functional as F
output = model(x)
loss = F.cross_entropy(output, y)
(2) line 106:
logits = model(x)

Hope it can be helpful.

@yilingo
Copy link

yilingo commented Jun 15, 2022

Change line 106 to logits = model(x) works.

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

No branches or pull requests

3 participants