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: Draws posterior samples from the guide and replays the model against
  those samples.
  
  :returns: A dict mapping sample site name to sample value.
      This includes latent, deterministic, and observed values.
  :rtype: dict
docstr_tok: ["Draws","posterior","samples","from","the","guide","and","replays","the","model","against","those","samples",".",":","returns",":","A","dict","mapping","sample","site","name","to","sample","value",".","This","includes","latent",",","deterministic",",","and","observed","values",".",":","rtype",":","dict"]
code: def __call__(self, *args, **kwargs) -> Dict[str, torch.Tensor]:  # type: ignore[override]
      """
      Draws posterior samples from the guide and replays the model against
      those samples.
  
      :returns: A dict mapping sample site name to sample value.
          This includes latent, deterministic, and observed values.
      :rtype: dict
      """
      self.args_kwargs = args, kwargs
      try:
          with self:
              self.model(*args, **kwargs)
      finally:
          del self.args_kwargs
  
      model_trace, guide_trace = self.get_traces()
      samples = {}
      for name, site in model_trace.nodes.items():
          if site["type"] == "sample":
              assert isinstance(site["value"], torch.Tensor)
              samples[name] = site["value"]
      return samples
  
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 4 for calling the GuideMessenger obj's underlying member method code with example usage: obj.__call__() and returns: samples