Skip to content

Commit

Permalink
mypy issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SkafteNicki committed Mar 11, 2023
1 parent 7be8601 commit bce8dc8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/torchmetrics/wrappers/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def best_metric(
if isinstance(self._base_metric, Metric):
fn = torch.max if self.maximize else torch.min
try:
value, idx = fn(res, 0) # type: ignore[arg-type]
value, idx = fn(res, 0)
if return_step:
return value.item(), idx.item()
return value.item()
Expand All @@ -237,7 +237,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 = {}, {}
for i, (k, v) in enumerate(res.items()): # type: ignore[union-attr]
for i, (k, v) in enumerate(res.items()):
try:
fn = torch.max if maximize[i] else torch.min
out = fn(v, 0)
Expand Down

0 comments on commit bce8dc8

Please sign in to comment.