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.
docstr: Adds a new data point to the sample. The values in successive calls to
  ``add`` must have the same tensor shape and size. Optionally, an
  importance weight can be specified via ``log_weight`` or ``weight``
  (default value of `1` is used if not specified).
  
  :param torch.Tensor value: tensor to add to the sample.
  :param torch.Tensor log_weight: log weight (optional) corresponding
      to the sample.
  :param int chain_id: chain id that generated the sample (optional).
      Note that if this argument is provided, ``chain_id`` must lie
      in ``[0, num_chains - 1]``, and there must be equal number
      of samples per chain.
docstr_tok: ["Adds","a","new","data","point","to","the","sample",".","The","values","in","successive","calls","to","``","add","``","must","have","the","same","tensor","shape","and","size",".","Optionally",",","an","importance","weight","can","be","specified","via","``","log_weight","``","or","``","weight","``","(","default","value","of","`","1","`","is","used","if","not","specified",")",".",":","param","torch.Tensor","value",":","tensor","to","add","to","the","sample",".",":","param","torch.Tensor","log_weight",":","log","weight","(","optional",")","corresponding","to","the","sample",".",":","param","int","chain_id",":","chain","id","that","generated","the","sample","(","optional",")",".","Note","that","if","this","argument","is","provided",",","``","chain_id","``","must","lie","in","``","[","0",",","num_chains","-","1","]","``",",","and","there","must","be","equal","number","of","samples","per","chain","."]
code: def _add_sample(self, value, log_weight=None, chain_id=0):
      """
      Adds a new data point to the sample. The values in successive calls to
      ``add`` must have the same tensor shape and size. Optionally, an
      importance weight can be specified via ``log_weight`` or ``weight``
      (default value of `1` is used if not specified).
  
      :param torch.Tensor value: tensor to add to the sample.
      :param torch.Tensor log_weight: log weight (optional) corresponding
          to the sample.
      :param int chain_id: chain id that generated the sample (optional).
          Note that if this argument is provided, ``chain_id`` must lie
          in ``[0, num_chains - 1]``, and there must be equal number
          of samples per chain.
      """
      # Apply default weight of 1.0.
      if log_weight is None:
          log_weight = 0.0
      if (
          self._validate_args
          and not isinstance(log_weight, numbers.Number)
          and log_weight.dim() > 0
      ):
          raise ValueError(
              "``weight.dim() > 0``, but weight should be a scalar."
          )
  
      # Append to the buffer list
      self._samples_buffer[chain_id].append(value)
      self._weights_buffer[chain_id].append(log_weight)
      self._num_chains = max(self._num_chains, chain_id + 1)
  
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 3 for calling the EmpiricalMarginal obj's underlying member method code with example usage: obj._add_sample(value, log_weight, chain_id) without return types