Skip to content

Commit

Permalink
Fix two typos
Browse files Browse the repository at this point in the history
  • Loading branch information
sadra-barikbin committed Jul 30, 2024
1 parent 5ed7068 commit c8b368f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ignite/metrics/metric_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from typing import Any, Callable, Dict
from typing import Any, Callable, Dict, Sequence

import torch

from ignite.metrics import Metric

Expand All @@ -18,7 +20,7 @@ class MetricGroup(Metric):
We construct a group of metrics, attach them to the engine at once and retrieve their result.
.. code-block:: python
metric_group = {'acc': Accuracy(), 'precision': Precision(), 'loss': Loss(nn.NLLLoss())}
metric_group = MetricGroup({'acc': Accuracy(), 'precision': Precision(), 'loss': Loss(nn.NLLLoss())})
metric_group.attach(default_evaluator, "eval_metrics")
y_true = torch.tensor([1, 0, 1, 1, 0, 1])
y_pred = torch.tensor([1, 0, 1, 0, 1, 1])
Expand All @@ -41,7 +43,7 @@ def reset(self):
for m in self.metrics.values():
m.reset()

def update(self, output):
def update(self, output: Sequence[torch.Tensor]):
for m in self.metrics.values():
m.update(m._output_transform(output))

Expand Down

0 comments on commit c8b368f

Please sign in to comment.