Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 3, 2024

Conversation

dcfidalgo
Copy link
Contributor

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

  • Non-breaking change (fix or new feature that would not break existing functionality).
  • Breaking change (fix or new feature that would cause existing functionality to change).
  • New tests added to cover the changes.
  • Integration tests passed locally by running ./runtests.sh -f -u --net --coverage.
  • Quick tests passed locally by running ./runtests.sh --quick --unittests --disttests.
  • In-line docstrings updated.
  • Documentation updated, tested make html command in the docs/ folder.

…is False

Signed-off-by: David Carreto Fidalgo <davidc.fidalgo@gmail.com>
Copy link
Member

@ericspod ericspod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! I think this looks good.

@ericspod ericspod requested a review from KumoLiu August 2, 2024 20:56
@KumoLiu
Copy link
Contributor

KumoLiu commented Aug 3, 2024

/build

@ericspod ericspod merged commit 56ee32e into Project-MONAI:dev Aug 3, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants