Skip to content

Commit

Permalink
more...
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda committed Oct 29, 2024
1 parent 8a49fc5 commit 85b6168
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/torchmetrics/wrappers/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ def best_metric(
) -> Union[
None,
float,
Tuple[Union[int, float], Union[int, float]],
Tensor,
Tuple[Union[int, float, Tensor], Union[int, float, Tensor]],
Tuple[None, None],
Dict[str, Union[float, None]],
Tuple[Dict[str, Union[float, None]], Dict[str, Union[int, None]]],
Expand Down Expand Up @@ -277,7 +278,7 @@ def best_metric(

else: # this is a metric collection
maximize = self.maximize if isinstance(self.maximize, list) else len(res) * [self.maximize]
value, idx = {}, {}
value, idx = {}, {} # type: ignore[assignment]
for i, (k, v) in enumerate(res.items()):
try:
fn = torch.max if maximize[i] else torch.min
Expand All @@ -290,7 +291,7 @@ def best_metric(
"Returning `None` instead.",
UserWarning,
)
value[k], idx[k] = None, None
value[k], idx[k] = None, None # type: ignore[assignment]

if return_step:
return value, idx
Expand Down

0 comments on commit 85b6168

Please sign in to comment.