Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.73k stars 1.05k forks source link

Fix: Small logic mistake in the `AsDiscrete.__call__` method #7984

Closed dcfidalgo closed 1 month ago

dcfidalgo commented 1 month ago

Hi MONAI Team! Thank you very much for this super nice framework, really appreciate it! Just found a small logic mistake in one of the transform classes. To reproduce:

import torch
from monai.transforms.post.array import AsDiscrete

transform = AsDiscrete(argmax=True)
prediction = torch.rand(2, 3, 3)

transform(prediction, argmax=False)
# will still apply argmax

Description

Proposed fix: argmax is explicitly checked for None in the __cal__ method.

Types of changes

KumoLiu commented 1 month ago

/build