UnboundLocalError: local variable 'b' referenced before assignment
Closed this issue ยท 1 comments
ZhiyuanChen commented
๐ 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 commented
Thanks! That was quick!