Skip to content

Commit

Permalink
Fix scores assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
stancld committed Sep 6, 2022
1 parent ebc1390 commit dcd6dd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/classification/jaccard.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _jaccard_from_confmat(

# If this class is absent in both target AND pred (union == 0), then use the absent_score for this class.
scores = intersection.float() / union.float()
scores.where(union == 0, torch.tensor(absent_score, dtype=scores.dtype, device=scores.device))
scores = scores.where(union == 0, torch.tensor(absent_score, dtype=scores.dtype, device=scores.device))

if ignore_index is not None and 0 <= ignore_index < num_classes:
scores = torch.cat(
Expand Down

0 comments on commit dcd6dd4

Please sign in to comment.