Skip to content

Commit

Permalink
fix row-wise division while normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
c00k1ez committed Sep 12, 2020
1 parent 3ba5e19 commit fd19c78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytorch_lightning/metrics/functional/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def confusion_matrix(
cm = bins.reshape(num_classes, num_classes).squeeze().float()

if normalize:
cm = cm / cm.sum(-1)
cm = cm / cm.sum(-1, keepdim=True)
nan_elements = cm[torch.isnan(cm)].nelement()
if nan_elements != 0:
cm[torch.isnan(cm)] = 0
Expand Down

0 comments on commit fd19c78

Please sign in to comment.