Skip to content

Commit

Permalink
Update src/torchmetrics/functional/segmentation/utils.py
Browse files Browse the repository at this point in the history
Co-authored-by: Jirka Borovec <6035284+Borda@users.noreply.github.com>
  • Loading branch information
SkafteNicki and Borda authored Apr 23, 2024
1 parent 57df85a commit 46e1183
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/torchmetrics/functional/segmentation/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def _ignore_background(preds: Tensor, target: Tensor) -> Tuple[Tensor, Tensor]:
"""Ignore the background class in the computation."""
"""Ignore the background class in the computation assuming it is the first, index 0."""
preds = preds[:, 1:] if preds.shape[1] > 1 else preds
target = target[:, 1:] if target.shape[1] > 1 else target
return preds, target
Expand Down

0 comments on commit 46e1183

Please sign in to comment.