Skip to content

Commit

Permalink
dev(BaseMetric): add docstring in self.add
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-tong committed Sep 13, 2022
1 parent 3baeae6 commit ceb2f3d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions mmeval/core/base_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def compute(self, size: Optional[int] = None) -> Dict:

# NOTE: Needs discussion or investigation @yancong at 9/13/2022, 4:20:48 PM # noqa: E501
# If the intermediate results stored in ``self._results`` are not
# correspond one-to-one with samples (e.g. confusion matrix), the size
# here may not work anymore.
# correspond one-to-one with samples (e.g. a total confusion matrix),
# the size here may not work anymore.
if size is not None:
collected_results = collected_results[:size]

Expand All @@ -145,8 +145,12 @@ def add(self, *args, **kwargs):
"""Override this method to add the intermediate results to
``self._results``.
For performance issue, what you add to the ``self._results`` should be
as simple as possible.
Note:
For performance issues, what you add to the ``self._results``
should be as simple as possible. But be aware that the intermediate
result stored in ``self._results`` should correspond one-to-one
with the samples, in that we need to remove the padded samples for
the most accurate result.
"""

@abstractmethod
Expand Down

0 comments on commit ceb2f3d

Please sign in to comment.