class_docstr: Abstract TracePosterior object from which posterior inference algorithms inherit.
  When run, collects a bag of execution traces from the approximate posterior.
  This is designed to be used by other utility classes like `EmpiricalMarginal`,
  that need access to the collected execution traces.
docstr: Calls `self._traces` to populate execution traces from a stochastic
  Pyro model.
  
  :param args: optional args taken by `self._traces`.
  :param kwargs: optional keywords args taken by `self._traces`.
docstr_tok: ["Calls","`","self._traces","`","to","populate","execution","traces","from","a","stochastic","Pyro","model",".",":","param","args",":","optional","args","taken","by","`","self._traces","`",".",":","param","kwargs",":","optional","keywords","args","taken","by","`","self._traces","`","."]
code: def run(self, *args, **kwargs):
      """
      Calls `self._traces` to populate execution traces from a stochastic
      Pyro model.
  
      :param args: optional args taken by `self._traces`.
      :param kwargs: optional keywords args taken by `self._traces`.
      """
      self._reset()
      with poutine.block():
          for i, vals in enumerate(self._traces(*args, **kwargs)):
              if len(vals) == 2:
                  chain_id = 0
                  tr, logit = vals
              else:
                  tr, logit, chain_id = vals
                  assert chain_id < self.num_chains
              self.exec_traces.append(tr)
              self.log_weights.append(logit)
              self.chain_ids.append(chain_id)
              self._idx_by_chain[chain_id].append(i)
      self._categorical = Categorical(
          logits=torch.tensor(self.log_weights)
      )
      return self
  
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 6 for calling the TracePosterior obj's underlying member method code with example usage: obj.run() and returns: self