Skip to content

dimension out of range (expected to be in range of [-1, 0], but got 1) #5554

@pranavkanade

Description

@pranavkanade
criterion = nn.CrossEntropyLoss()

print(outputs.data)
print(label.data)
loss = criterion(outputs, label)      # getting error at this point

The output that I'm getting is =>

 0.0174
 0.1866
[torch.FloatTensor of size 2]


 0
 1
[torch.FloatTensor of size 2]

This is correct as far as the documentation is concern, but still getting following error
dimension out of range (expected to be in range of [-1, 0], but got 1)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions