class_docstr: Preconditioning interpretation for adjoint computations.
  
  This interpretation is intended to be used once, followed by a call to
  :meth:`combine_subs` as follows::
  
      # Lazily build a factor graph.
      with reflect:
          log_joint = Gaussian(...) + ... + Gaussian(...)
          log_Z = log_joint.reduce(ops.logaddexp)
  
      # Run a backward sampling under the precondition interpretation.
      with Precondition() as p:
          marginals = adjoint(
              ops.logaddexp, ops.add, log_Z, batch_vars=p.sample_vars
          )
      combine_subs = p.combine_subs()
  
      # Extract samples from Delta distributions.
      samples = {
          k: v(**combine_subs)
          for name, delta in marginals.items()
          for k, v in funsor.montecarlo.extract_samples(delta).items()
      }
  
  See :func:`~funsor.recipes.forward_filter_backward_precondition` for
  complete usage.
  
  :param str aux_name: Name of the auxiliary variable containing white noise.
class_docstr_tok: ["Preconditioning","interpretation","for","adjoint","computations",".","This","interpretation","is","intended","to","be","used","once",",","followed","by","a","call","to",":","meth",":","`","combine_subs","`","as","follows",":",":","#","Lazily","build","a","factor","graph",".","with","reflect",":","log_joint","=","Gaussian","(","...",")","+","...","+","Gaussian","(","...",")","log_Z","=","log_joint.reduce","(","ops.logaddexp",")","#","Run","a","backward","sampling","under","the","precondition","interpretation",".","with","Precondition","(",")","as","p",":","marginals","=","adjoint","(","ops.logaddexp",",","ops.add",",","log_Z",",","batch_vars=p.sample_vars",")","combine_subs","=","p.combine_subs","(",")","#","Extract","samples","from","Delta","distributions",".","samples","=","{","k",":","v","(","*","*","combine_subs",")","for","name",",","delta","in","marginals.items","(",")","for","k",",","v","in","funsor.montecarlo.extract_samples","(","delta",")",".items","(",")","}","See",":","func",":","`","~funsor.recipes.forward_filter_backward_precondition","`","for","complete","usage",".",":","param","str","aux_name",":","Name","of","the","auxiliary","variable","containing","white","noise","."]
code: def __init__(self, aux_name="aux"):
      super().__init__("precondition")
      self.aux_name = aux_name
      self.sample_inputs = OrderedDict()
      self.sample_vars = set()
  
file_path: funsor/funsor/precondition.py
imports: from collections import OrderedDict
  from .None import ops
  from .cnf import Contraction, GaussianMixture
  from .domains import Reals
  from .gaussian import Gaussian
  from .interpretations import StatefulInterpretation
  from .terms import Approximate, Funsor, Subs, Variable
label_desc: Use image node_id 1 to create a new Precondition object from inherited base classes: StatefulInterpretation with example: obj = Precondition(aux_name)