class_docstr: Track non-reparameterizable sample sites.
  
  **References:**
  
  1. *Nonstandard Interpretations of Probabilistic Programs for Efficient Inference*,
      David Wingate, Noah Goodman, Andreas Stuhlmüller, Jeffrey Siskind
  
  **Example:**
  
  .. doctest::
  
     >>> import torch
     >>> import pyro
     >>> import pyro.distributions as dist
     >>> from pyro.infer.tracegraph_elbo import TrackNonReparam
     >>> from pyro.ops.provenance import get_provenance
     >>> from pyro.poutine import trace
  
     >>> def model():
     ...     probs_a = torch.tensor([0.3, 0.7])
     ...     probs_b = torch.tensor([[0.1, 0.9], [0.8, 0.2]])
     ...     probs_c = torch.tensor([[0.5, 0.5], [0.6, 0.4]])
     ...     a = pyro.sample("a", dist.Categorical(probs_a))
     ...     b = pyro.sample("b", dist.Categorical(probs_b[a]))
     ...     pyro.sample("c", dist.Categorical(probs_c[b]), obs=torch.tensor(0))
  
     >>> with TrackNonReparam():
     ...     model_tr = trace(model).get_trace()
     >>> model_tr.compute_log_prob()
  
     >>> print(get_provenance(model_tr.nodes["a"]["log_prob"]))  # doctest: +SKIP
     frozenset({'a'})
     >>> print(get_provenance(model_tr.nodes["b"]["log_prob"]))  # doctest: +SKIP
     frozenset({'b', 'a'})
     >>> print(get_provenance(model_tr.nodes["c"]["log_prob"]))  # doctest: +SKIP
     frozenset({'b', 'a'})
code: def _pyro_post_sample(self, msg):
      if (
          msg["type"] == "sample"
          and not isinstance(msg["fn"], _Subsample)
          and not msg["is_observed"]
          and not getattr(msg["fn"], "has_rsample", False)
      ):
          provenance = frozenset({msg["name"]})
          msg["value"] = track_provenance(msg["value"], provenance)
  
imports: import weakref
  from collections import defaultdict
  from operator import itemgetter
  import torch
  import pyro
  import pyro.ops.jit
  from pyro.distributions.util import detach, is_identically_zero
  from pyro.infer import ELBO
  from pyro.infer.enum import get_importance_trace
  from pyro.infer.util import MultiFrameTensor, get_plate_stacks, is_validation_enabled, torch_backward, torch_item
  from pyro.ops.provenance import detach_provenance, get_provenance, track_provenance
  from pyro.poutine.messenger import Messenger
  from pyro.poutine.subsample_messenger import _Subsample
  from pyro.util import check_if_enumerated, warn_if_nan
label_desc: Use image node_id 1 for calling the TrackNonReparam obj's underlying member method code with example usage: obj._pyro_post_sample(msg) without return types