class_docstr: Marginal distribution over a single site (or multiple, provided they have the same
  shape) from the ``TracePosterior``'s model.
  
  .. note:: If multiple sites are specified, they must have the same tensor shape.
      Samples from each site will be stacked and stored within a single tensor. See
      :class:`~pyro.distributions.Empirical`. To hold the marginal distribution of sites
      having different shapes, use :class:`~pyro.infer.abstract_infer.Marginals` instead.
  
  :param TracePosterior trace_posterior: a ``TracePosterior`` instance representing
      a Monte Carlo posterior.
  :param list sites: optional list of sites for which we need to generate
      the marginal distribution.
code: def _populate_traces(self, trace_posterior, sites):
      assert isinstance(sites, (list, str))
      for tr, log_weight, chain_id in zip(
          trace_posterior.exec_traces,
          trace_posterior.log_weights,
          trace_posterior.chain_ids,
      ):
          value = (
              tr.nodes[sites]["value"]
              if isinstance(sites, str)
              else torch.stack(
                  [tr.nodes[site]["value"] for site in sites], 0
              )
          )
          self._add_sample(
              value, log_weight=log_weight, chain_id=chain_id
          )
  
imports: import numbers
  import warnings
  from abc import ABCMeta, abstractmethod
  from collections import OrderedDict, defaultdict
  import torch
  import pyro.poutine
  from pyro.distributions import Categorical, Empirical
  from pyro.ops.stats import waic
  from pyro.poutine.util import site_is_subsample
label_desc: Use image node_id 4 for calling the EmpiricalMarginal obj's underlying member method code with example usage: obj._populate_traces(trace_posterior, sites) without return types