From 91b99157426104febbb69caa1fdef01a7d61fe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cmohansree14=E2=80=9D?= <“mohansree1709@gmail.com”> Date: Thu, 20 Aug 2026 22:38:56 +0100 Subject: [PATCH] docs(auroc): clarify per-batch logit/probability check in BinaryAUROC Fixes #2195 - the sigmoid-vs-probability check in update() runs per batch, not across the full dataset, which can silently produce inconsistent conversion behavior across batches. Documented this in the class docstring. --- src/torchmetrics/classification/auroc.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/torchmetrics/classification/auroc.py b/src/torchmetrics/classification/auroc.py index 68960e203e9..473ce787fbf 100644 --- a/src/torchmetrics/classification/auroc.py +++ b/src/torchmetrics/classification/auroc.py @@ -57,6 +57,13 @@ class BinaryAUROC(BinaryPrecisionRecallCurve): therefore only contain {0,1} values (except if `ignore_index` is specified). The value 1 always encodes the positive class. + .. note:: + The probabilities-or-logits check above is applied independently on every ``update()`` call, i.e. per batch + rather than across the full accumulated dataset. If you call ``update()`` with small batches, a batch whose + predictions happen to all fall inside ``[0, 1]`` will **not** have sigmoid applied, even if other batches in + the same run were treated as logits. To avoid inconsistent results, either pass probabilities (post-sigmoid) + consistently across all batches, or apply ``torch.sigmoid`` yourself before calling ``update()``. + As output to ``forward`` and ``compute`` the metric returns the following output: - ``b_auroc`` (:class:`~torch.Tensor`): A single scalar with the auroc score.