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

UnboundLocalError: local variable 'b' referenced before assignment #2742

Closed
ZhiyuanChen opened this issue Sep 13, 2024 · 1 comment · Fixed by #2743
Closed

UnboundLocalError: local variable 'b' referenced before assignment #2742

ZhiyuanChen opened this issue Sep 13, 2024 · 1 comment · Fixed by #2743
Labels
bug / fix Something isn't working help wanted Extra attention is needed

Comments

@ZhiyuanChen
Copy link

ZhiyuanChen commented Sep 13, 2024

🐛 Bug

To Reproduce

  File "/opt/conda/lib/python3.10/site-packages/torchmetrics/functional/classification/matthews_corrcoef.py", line 278, in matthews_corrcoef
    return binary_matthews_corrcoef(preds, target, threshold, ignore_index, validate_args)
  File "/opt/conda/lib/python3.10/site-packages/torchmetrics/functional/classification/matthews_corrcoef.py", line 132, in binary_matthews_corrcoef
    return _matthews_corrcoef_reduce(confmat)
  File "/opt/conda/lib/python3.10/site-packages/torchmetrics/functional/classification/matthews_corrcoef.py", line 74, in _matthews_corrcoef_reduce
    numerator = torch.sqrt(eps) * (a - b)
Code sample
# Ideally attach a minimal code sample to reproduce the decried issue.
# Minimal means having the shortest code but still preserving the bug.

Expected behavior

Environment

  • TorchMetrics version (if build from source, add commit SHA): ???
  • Python & PyTorch Version (e.g., 1.0): ???
  • Any other relevant information such as OS (e.g., Linux): ???

Additional context

@ZhiyuanChen ZhiyuanChen added bug / fix Something isn't working help wanted Extra attention is needed labels Sep 13, 2024
@ZhiyuanChen
Copy link
Author

Thanks! That was quick!

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 help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant