MulticlassAccuracy Calculation Results in Dimension Mismatch Error #2946
Unanswered
okezieowen
asked this question in
Classification
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I try to compute the multiclass accuracy for a preds/target input with a top_k value greater than 1, I get an error about mismatched dimensions.
According to the documentation, preds can be a float tensor of shape (N, C, ...) and target an integer tensor of shape (N, ...).
To Reproduce
Steps to reproduce the behavior...
I get the error message:
RuntimeError: The size of tensor a (4) must match the size of tensor b (7) at non-singleton dimension 0
Code sample
Expected Behavior
I expect the output to be a scalar tensor as mentioned in the documentation.
Environment
Additional context
Beta Was this translation helpful? Give feedback.
All reactions