From 73863e91028675fb298e426c841ea544741e61d0 Mon Sep 17 00:00:00 2001 From: Dusan Drevicky <55678224+ddrevicky@users.noreply.github.com> Date: Wed, 21 Oct 2020 11:18:25 +0200 Subject: [PATCH] Fix unintended zero-only target in iou example (#4262) --- pytorch_lightning/metrics/functional/classification.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pytorch_lightning/metrics/functional/classification.py b/pytorch_lightning/metrics/functional/classification.py index 8af2a7ca1e..43dda00fc0 100644 --- a/pytorch_lightning/metrics/functional/classification.py +++ b/pytorch_lightning/metrics/functional/classification.py @@ -1024,11 +1024,11 @@ def iou( Example: - >>> target = torch.randint(0, 1, (10, 25, 25)) + >>> target = torch.randint(0, 2, (10, 25, 25)) >>> pred = torch.tensor(target) >>> pred[2:5, 7:13, 9:15] = 1 - pred[2:5, 7:13, 9:15] >>> iou(pred, target) - tensor(0.4914) + tensor(0.9660) """ num_classes = get_num_classes(pred=pred, target=target, num_classes=num_classes)