-
Notifications
You must be signed in to change notification settings - Fork 466
Open
Labels
bug / fixSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
🐛 Bug
Using logauc function gives the following Userwarning:
torchmetrics/src/torchmetrics/functional/classification/logauc.py:52: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.detach().clone() or sourceTensor.detach().clone().requires_grad_(True), rather than torch.tensor(sourceTensor).
To Reproduce
Sample code and steps to reproduce the behavior with expected result...
Code sample
# Ideally attach a minimal code sample to reproduce the decried issue.
# Minimal means having the shortest code but still preserving the bug.
import torch
from torchmetrics.functional.classification.logauc import logauc
preds = torch.tensor([0.9, 0.1, 0.8, 0.2, 0.05])
target = torch.tensor([1, 0, 1, 0, 0])
score = logauc(
preds=preds,
target=target,
task="binary",
)
print("LogAUC score:", score)Environment
- TorchMetrics version (if build from source, add commit SHA): 1.9.0.dev0
- Python & PyTorch Version (e.g., 1.0): Python 3.10.18 & Pytorch 2.8.0
- Any other relevant information such as OS (e.g., Linux): Ubuntu
Additional context
Metadata
Metadata
Assignees
Labels
bug / fixSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed