-
-
Notifications
You must be signed in to change notification settings - Fork 692
Replace all torch.Tensor by torch.tensor #2527
Copy link
Copy link
Closed
Labels
Description
📚 Documentation
@sdesrozis it is incorrect to create tensors with torch.Tensor and should be replaced by torch.tensor.
ignite/ignite/metrics/accuracy.py
Lines 125 to 134 in 3b821e2
| Binary case | |
| .. testcode:: 1 | |
| metric = Accuracy() | |
| metric.attach(default_evaluator, "accuracy") | |
| y_true = torch.Tensor([1, 0, 1, 1, 0, 1]) | |
| y_pred = torch.Tensor([1, 0, 1, 0, 1, 1]) | |
| state = default_evaluator.run([[y_pred, y_true]]) | |
| print(state.metrics["accuracy"]) |
This way we wont need neither cast to .long : y_true = torch.Tensor([2, 0, 2, 1, 0, 1]).long()
ignite/ignite/metrics/accuracy.py
Line 146 in 3b821e2
| y_true = torch.Tensor([2, 0, 2, 1, 0, 1]).long() |
Reactions are currently unavailable