Skip to content

Commit

Permalink
Update MetricTracker (Lightning-AI#1428)
Browse files Browse the repository at this point in the history
* Add check on maximize to be a singe bool when the metric is a single Metric
  • Loading branch information
ValerianRey committed Jan 6, 2023
1 parent 03455bc commit cb62cef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/torchmetrics/wrappers/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ def __init__(self, metric: Union[Metric, MetricCollection], maximize: Union[bool
raise ValueError("Argument `maximize` should either be a single bool or list of bool")
if isinstance(maximize, list) and isinstance(metric, MetricCollection) and len(maximize) != len(metric):
raise ValueError("The len of argument `maximize` should match the length of the metric collection")
if isinstance(metric, Metric) and not isinstance(maximize, bool):
raise ValueError("Argument `maximize` should be a single bool when `metric` is a single Metric")
self.maximize = maximize

self._increment_called = False
Expand Down

0 comments on commit cb62cef

Please sign in to comment.