class_docstr: :class:`AutoMessenger` with recursively affine-transformed priors using
  prior dependency structure.
  
  The posterior at any site is a learned affine transform of the prior,
  conditioned on upstream posterior samples. The affine transform operates in
  unconstrained space. This supports only continuous latent variables.
  
  Derived classes may override the :meth:`get_posterior` behavior at
  particular sites and use the regressive behavior simply as a default,
  e.g.::
  
      class MyGuideMessenger(AutoRegressiveMessenger):
          def get_posterior(self, name, prior):
              if name == "x":
                  # Use a custom distribution at site x.
                  loc = pyro.param("x_loc", lambda: torch.zeros(prior.shape()))
                  scale = pyro.param("x_scale", lambda: torch.ones(prior.shape())),
                                     constraint=constraints.positive
                  return dist.Normal(loc, scale).to_event(prior.event_dim())
              # Fall back to autoregressive.
              return super().get_posterior(name, prior)
  
  .. warning:: This guide currently does not support jit-based elbos.
  
  :param callable model: A Pyro model.
  :param callable init_loc_fn: A per-site initialization function.
      See :ref:`autoguide-initialization` section for available functions.
  :param float init_scale: Initial scale for the standard deviation of each
      (unconstrained transformed) latent variable.
  :param tuple amortized_plates: A tuple of names of plates over which guide
      parameters should be shared. This is useful for subsampling, where a
      guide parameter can be shared across all plates.
class_docstr_tok: [":","class",":","`","AutoMessenger","`","with","recursively","affine-transformed","priors","using","prior","dependency","structure",".","The","posterior","at","any","site","is","a","learned","affine","transform","of","the","prior",",","conditioned","on","upstream","posterior","samples",".","The","affine","transform","operates","in","unconstrained","space",".","This","supports","only","continuous","latent","variables",".","Derived","classes","may","override","the",":","meth",":","`","get_posterior","`","behavior","at","particular","sites","and","use","the","regressive","behavior","simply","as","a","default",",","e.g",".",":",":","class","MyGuideMessenger","(","AutoRegressiveMessenger",")",":","def","get_posterior","(","self",",","name",",","prior",")",":","if","name","==","``","x","''",":","#","Use","a","custom","distribution","at","site","x.","loc","=","pyro.param","(","``","x_loc","''",",","lambda",":","torch.zeros","(","prior.shape","(",")",")",")","scale","=","pyro.param","(","``","x_scale","''",",","lambda",":","torch.ones","(","prior.shape","(",")",")",")",",","constraint=constraints.positive","return","dist.Normal","(","loc",",","scale",")",".to_event","(","prior.event_dim","(",")",")","#","Fall","back","to","autoregressive",".","return","super","(",")",".get_posterior","(","name",",","prior",")","..","warning",":",":","This","guide","currently","does","not","support","jit-based","elbos",".",":","param","callable","model",":","A","Pyro","model",".",":","param","callable","init_loc_fn",":","A","per-site","initialization","function",".","See",":","ref",":","`","autoguide-initialization","`","section","for","available","functions",".",":","param","float","init_scale",":","Initial","scale","for","the","standard","deviation","of","each","(","unconstrained","transformed",")","latent","variable",".",":","param","tuple","amortized_plates",":","A","tuple","of","names","of","plates","over","which","guide","parameters","should","be","shared",".","This","is","useful","for","subsampling",",","where","a","guide","parameter","can","be","shared","across","all","plates","."]
code: def _get_params(self, name: str, prior: Distribution):
      try:
          loc = deep_getattr(self.locs, name)
          scale = deep_getattr(self.scales, name)
          return loc, scale
      except AttributeError:
          pass
  
      # Initialize.
      with torch.no_grad():
          transform = biject_to(prior.support)
          event_dim = transform.domain.event_dim
          constrained = self.init_loc_fn(
              {"name": name, "fn": prior}
          ).detach()
          unconstrained = transform.inv(constrained)
          # Initialize the distribution to be an affine combination:
          #   init_scale * prior + (1 - init_scale) * init_loc
          init_loc = self._adjust_plates(unconstrained, event_dim)
          init_loc = init_loc * (1 - self._init_scale)
          init_scale = torch.full_like(init_loc, self._init_scale)
  
      deep_setattr(
          self, "locs." + name, PyroParam(init_loc, event_dim=event_dim)
      )
      deep_setattr(
          self,
          "scales." + name,
          PyroParam(
              init_scale,
              constraint=constraints.positive,
              event_dim=event_dim,
          ),
      )
      return self._get_params(name, prior)
  
imports: from typing import Callable, Optional, Tuple, Union
  import torch
  from torch.distributions import biject_to, constraints
  import pyro.distributions
  from pyro.distributions.distribution import Distribution
  from pyro.nn.module import PyroModule, PyroParam, pyro_method
  from pyro.ops.tensor_utils import periodic_repeat
  from pyro.poutine.guide import GuideMessenger
  from pyro.poutine.runtime import get_plates
  from .initialization import init_to_feasible, init_to_mean
  from .utils import deep_getattr, deep_setattr, helpful_support_errors
label_desc: Use image node_id 3 for calling the AutoRegressiveMessenger obj's underlying member method code with example usage: obj._get_params(name, prior) and returns: self, loc,  scale