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: Abstract method to compute a posterior distribution or sample a
  posterior value given a prior distribution conditioned on upstream
  posterior samples.
  
  Implementations may use ``pyro.param`` and ``pyro.sample`` inside this
  function, but ``pyro.sample`` statements should set
  ``infer={"is_auxiliary": True"}`` .
  
  Implementations may access further information for computations:
  
  - ``value = self.upstream_value(name)`` is the value of an upstream
     sample or deterministic site.
  -  ``self.trace`` is a trace of upstream sites, and may be useful for
     other information such as ``self.trace.nodes["my_site"]["fn"]`` or
     ``self.trace.nodes["my_site"]["cond_indep_stack"]`` .
  -  ``args, kwargs = self.args_kwargs`` are the inputs to the model, and
      may be useful for amortization.
  
  :param str name: The name of the sample site to sample.
  :param prior: The prior distribution of this sample site
      (conditioned on upstream samples from the posterior).
  :type prior: ~pyro.distributions.Distribution
  :returns: A posterior distribution or sample from the posterior
      distribution.
  :rtype: ~pyro.distributions.Distribution or torch.Tensor
docstr_tok: ["Abstract","method","to","compute","a","posterior","distribution","or","sample","a","posterior","value","given","a","prior","distribution","conditioned","on","upstream","posterior","samples",".","Implementations","may","use","``","pyro.param","``","and","``","pyro.sample","``","inside","this","function",",","but","``","pyro.sample","``","statements","should","set","``","infer=","{","``","is_auxiliary","''",":","True","''","}","``",".","Implementations","may","access","further","information","for","computations",":","-","``","value","=","self.upstream_value","(","name",")","``","is","the","value","of","an","upstream","sample","or","deterministic","site",".","-","``","self.trace","``","is","a","trace","of","upstream","sites",",","and","may","be","useful","for","other","information","such","as","``","self.trace.nodes","[","``","my_site","''","]","[","``","fn","''","]","``","or","``","self.trace.nodes","[","``","my_site","''","]","[","``","cond_indep_stack","''","]","``",".","-","``","args",",","kwargs","=","self.args_kwargs","``","are","the","inputs","to","the","model",",","and","may","be","useful","for","amortization",".",":","param","str","name",":","The","name","of","the","sample","site","to","sample",".",":","param","prior",":","The","prior","distribution","of","this","sample","site","(","conditioned","on","upstream","samples","from","the","posterior",")",".",":","type","prior",":","~pyro.distributions.Distribution",":","returns",":","A","posterior","distribution","or","sample","from","the","posterior","distribution",".",":","rtype",":","~pyro.distributions.Distribution","or","torch.Tensor"]
code: def get_posterior(
      self, name: str, prior: "TorchDistributionMixin"
  ) -> Union["TorchDistributionMixin", torch.Tensor]:
      """
      Abstract method to compute a posterior distribution or sample a
      posterior value given a prior distribution conditioned on upstream
      posterior samples.
  
      Implementations may use ``pyro.param`` and ``pyro.sample`` inside this
      function, but ``pyro.sample`` statements should set
      ``infer={"is_auxiliary": True"}`` .
  
      Implementations may access further information for computations:
  
      - ``value = self.upstream_value(name)`` is the value of an upstream
         sample or deterministic site.
      -  ``self.trace`` is a trace of upstream sites, and may be useful for
         other information such as ``self.trace.nodes["my_site"]["fn"]`` or
         ``self.trace.nodes["my_site"]["cond_indep_stack"]`` .
      -  ``args, kwargs = self.args_kwargs`` are the inputs to the model, and
          may be useful for amortization.
  
      :param str name: The name of the sample site to sample.
      :param prior: The prior distribution of this sample site
          (conditioned on upstream samples from the posterior).
      :type prior: ~pyro.distributions.Distribution
      :returns: A posterior distribution or sample from the posterior
          distribution.
      :rtype: ~pyro.distributions.Distribution or torch.Tensor
      """
      raise NotImplementedError
  
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 7 for calling the GuideMessenger obj's underlying member method code with example usage: obj.get_posterior(name, prior) without return types