class_docstr: Statistics of samples that are dictionaries with constant set of keys.
  
  For example the following are equivalent::
  
      # Version 1. Hand encode statistics.
      >>> a_stats = CountStats()
      >>> b_stats = CountMeanStats()
      >>> a_stats.update(torch.tensor(0.))
      >>> b_stats.update(torch.tensor([1., 2.]))
      >>> summary = {"a": a_stats.get(), "b": b_stats.get()}
  
      # Version 2. Collect samples into dictionaries.
      >>> stats = StatsOfDict({"a": CountStats, "b": CountMeanStats})
      >>> stats.update({"a": torch.tensor(0.), "b": torch.tensor([1., 2.])})
      >>> summary = stats.get()
      >>> summary
      {'a': {'count': 1}, 'b': {'count': 1, 'mean': tensor([1., 2.])}}
  
  :param default: Default type of statistics of values of the dictionary.
      Defaults to the inexpensive :class:`CountStats`.
  :param dict types: Dictionary mapping key to type of statistic that should
      be recorded for values corresponding to that key.
code: def merge(self, other: "StatsOfDict") -> "StatsOfDict":
      assert isinstance(other, type(self))
      result = copy.deepcopy(self)
      for k in set(self.stats).union(other.stats):
          if k not in self.stats:
              result.stats[k] = copy.deepcopy(other.stats[k])
          elif k in other.stats:
              result.stats[k] = self.stats[k].merge(other.stats[k])
      return result
  
imports: import copy
  from abc import ABC, abstractmethod
  from collections import defaultdict
  from typing import Any, Callable, Dict, Hashable, Union
  import torch
  from pyro.ops.welford import WelfordCovariance
label_desc: Use image node_id 3 for calling the StatsOfDict obj's underlying member method code with example usage: obj.merge(other) and returns: result