Accuracy Metric does not perform squeeze on input data #1233
Unanswered
jungla88
asked this question in
Classification
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I am not sure if this is a bug or not but according to https://torchmetrics.readthedocs.io/en/stable/pages/classification.html#input-types, prediction tensor is squeezed starting from dimension one. Accuracy seems not performing such operation and in validity checks raised an error:
preds = torch.tensor([0.4,0.51,0.51,0.6,0.7])
target = torch.tensor([0,1,0,0,1])
acc = Accuracy(num_classes=1)
acc(preds,target)
This works ok, whilst when
acc(preds.unsqueeze(dim=1),target)
:ValueError: The highest label in target should be smaller than the size of the C dimension of preds.
Beta Was this translation helpful? Give feedback.
All reactions