class_docstr: This class is used in Reporter.
  
  See the docstring of Reporter for the usage.
class_docstr_tok: ["This","class","is","used","in","Reporter",".","See","the","docstring","of","Reporter","for","the","usage","."]
docstr: Close up this step and reset state for the next step
docstr_tok: ["Close","up","this","step","and","reset","state","for","the","next","step"]
code: def next(self):
      """Close up this step and reset state for the next step"""
      for key, stats_list in self.stats.items():
          if key not in self._seen_keys_in_the_step:
              # Fill nan value if the key is not registered in this step
              if isinstance(stats_list[0], WeightedAverage):
                  stats_list.append(to_reported_value(np.nan, 0))
              elif isinstance(stats_list[0], Average):
                  stats_list.append(to_reported_value(np.nan))
              else:
                  raise NotImplementedError(
                      f"type={type(stats_list[0])}"
                  )
  
          assert len(stats_list) == self.count, (
              len(stats_list),
              self.count,
          )
  
      self._seen_keys_in_the_step = set()
  
imports: import dataclasses
  import datetime
  import logging
  import time
  import warnings
  from collections import defaultdict
  from contextlib import contextmanager
  from pathlib import Path
  from typing import ContextManager, Dict, List, Optional, Sequence, Tuple, Union
  import humanfriendly
  import numpy
  import torch
  from packaging.version import parse
  from typeguard import check_argument_types, check_return_type
label_desc: Use image node_id 4 for calling the SubReporter obj's underlying member method code with example usage: obj.next() without return types