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","."]
code: def register(
      self,
      stats: Dict[str, Optional[Union[Num, Dict[str, Num]]]],
      weight: Num = None,
  ) -> None:
      assert check_argument_types()
      if self._finished:
          raise RuntimeError("Already finished")
      if len(self._seen_keys_in_the_step) == 0:
          # Increment count as the first register in this step
          self.total_count += 1
          self.count += 1
  
      for key2, v in stats.items():
          if key2 in _reserved:
              raise RuntimeError(f"{key2} is reserved.")
          if key2 in self._seen_keys_in_the_step:
              raise RuntimeError(f"{key2} is registered twice.")
          if v is None:
              v = np.nan
          r = to_reported_value(v, weight)
  
          if key2 not in self.stats:
              # If it's the first time to register the key,
              # append nan values in front of the the value
              # to make it same length to the other stats
              # e.g.
              # stat A: [0.4, 0.3, 0.5]
              # stat B: [nan, nan, 0.2]
              nan = to_reported_value(
                  np.nan, None if weight is None else 0
              )
              self.stats[key2].extend(
                  r if i == self.count - 1 else nan
                  for i in range(self.count)
              )
          else:
              self.stats[key2].append(r)
          self._seen_keys_in_the_step.add(key2)
  
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 5 for calling the SubReporter obj's underlying member method code with example usage: obj.register(stats, weight) without return types