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

Cannot use average method 'none' in Dice meter #2262

Closed
CielAl opened this issue Dec 5, 2023 · 2 comments · Fixed by #2725
Closed

Cannot use average method 'none' in Dice meter #2262

CielAl opened this issue Dec 5, 2023 · 2 comments · Fixed by #2725
Labels
bug / fix Something isn't working good first issue Good for newcomers help wanted Extra attention is needed v1.2.x

Comments

@CielAl
Copy link

CielAl commented Dec 5, 2023

🐛 Bug

In the docstring of
it states that average allows none or None input wherein a class-wise result will be reported. However the code here https://github.com/Lightning-AI/torchmetrics/blob/master/src/torchmetrics/classification/dice.py#L176 suggests that a ValueError will be raised and therefore average must be micro/macro/sample.

It appears that the value check is redundant considering the following line was added already.

        if average not in allowed_average:
            raise ValueError(f"The `average` has to be one of {allowed_average}, got {average}.")

To Reproduce

Steps to reproduce the behavior...

Code sample

Expected behavior

Environment

  • TorchMetrics version (and how you installed TM, e.g. conda, pip, build from source):
  • Python & PyTorch Version (e.g., 1.0):
  • Any other relevant information such as OS (e.g., Linux):

Additional context

@CielAl CielAl added bug / fix Something isn't working help wanted Extra attention is needed labels Dec 5, 2023
Copy link

github-actions bot commented Dec 5, 2023

Hi! thanks for your contribution!, great first issue!

@Borda Borda added the v1.2.x label Dec 27, 2023
@Borda
Copy link
Member

Borda commented Dec 27, 2023

seems to be related to #2282

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug / fix Something isn't working good first issue Good for newcomers help wanted Extra attention is needed v1.2.x
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@Borda @CielAl and others