class_docstr: Abstract base class for effect-based guides.
  
  Derived classes must implement the :meth:`get_posterior` method.
class_docstr_tok: ["Abstract","base","class","for","effect-based","guides",".","Derived","classes","must","implement","the",":","meth",":","`","get_posterior","`","method","."]
docstr: This can be called after running :meth:`__call__` to extract a pair of
  traces.
  
  In contrast to the trace-replay pattern of generating a pair of traces,
  :class:`GuideMessenger` interleaves model and guide computations, so
  only a single ``guide(*args, **kwargs)`` call is needed to create both
  traces. This function merely extract the relevant information from this
  guide's ``.trace`` attribute.
  
  :returns: a pair ``(model_trace, guide_trace)``
  :rtype: tuple
docstr_tok: ["This","can","be","called","after","running",":","meth",":","`","__call__","`","to","extract","a","pair","of","traces",".","In","contrast","to","the","trace-replay","pattern","of","generating","a","pair","of","traces",",",":","class",":","`","GuideMessenger","`","interleaves","model","and","guide","computations",",","so","only","a","single","``","guide","(","*","args",",","*","*","kwargs",")","``","call","is","needed","to","create","both","traces",".","This","function","merely","extract","the","relevant","information","from","this","guide","'s","``",".trace","``","attribute",".",":","returns",":","a","pair","``","(","model_trace",",","guide_trace",")","``",":","rtype",":","tuple"]
code: def get_traces(self) -> Tuple[Trace, Trace]:
      """
      This can be called after running :meth:`__call__` to extract a pair of
      traces.
  
      In contrast to the trace-replay pattern of generating a pair of traces,
      :class:`GuideMessenger` interleaves model and guide computations, so
      only a single ``guide(*args, **kwargs)`` call is needed to create both
      traces. This function merely extract the relevant information from this
      guide's ``.trace`` attribute.
  
      :returns: a pair ``(model_trace, guide_trace)``
      :rtype: tuple
      """
      guide_trace = prune_subsample_sites(self.trace)
      model_trace = model_trace = guide_trace.copy()
      for name, guide_site in list(guide_trace.nodes.items()):
          if (
              guide_site["type"] != "sample"
              or guide_site["is_observed"]
          ):
              del guide_trace.nodes[name]
              continue
          model_site = model_trace.nodes[name].copy()
          assert guide_site["infer"] is not None
          model_site["fn"] = guide_site["infer"]["prior"]
          model_trace.nodes[name] = model_site
      return model_trace, guide_trace
  
file_path: pyro/pyro/poutine/guide.py
imports: from abc import ABC, abstractmethod
  from typing import TYPE_CHECKING, Callable, Dict, Optional, Tuple, Union
  import torch
  import pyro.distributions
  from pyro.poutine.trace_messenger import TraceMessenger
  from pyro.poutine.trace_struct import Trace
  from pyro.poutine.util import prune_subsample_sites, site_is_subsample
label_desc: Use image node_id 9 for calling the GuideMessenger obj's underlying member method code with example usage: obj.get_traces() and returns: model_trace,  guide_trace