class_docstr: Neural Transport reparameterizer [1] of multiple latent variables.
  
  This uses a trained :class:`~pyro.infer.autoguide.AutoContinuous`
  guide to alter the geometry of a model, typically for use e.g. in MCMC.
  Example usage::
  
      # Step 1. Train a guide
      guide = AutoIAFNormal(model)
      svi = SVI(model, guide, ...)
      # ...train the guide...
  
      # Step 2. Use trained guide in NeuTra MCMC
      neutra = NeuTraReparam(guide)
      model = poutine.reparam(model, config=lambda _: neutra)
      nuts = NUTS(model)
      # ...now use the model in HMC or NUTS...
  
  This reparameterization works only for latent variables, not likelihoods.
  Note that all sites must share a single common :class:`NeuTraReparam`
  instance, and that the model must have static structure.
  
  [1] Hoffman, M. et al. (2019)
      "NeuTra-lizing Bad Geometry in Hamiltonian Monte Carlo Using Neural Transport"
      https://arxiv.org/abs/1903.03704
  
  :param ~pyro.infer.autoguide.AutoContinuous guide: A trained guide.
docstr: Given latent samples from the warped posterior (with a possible batch dimension),
  return a `dict` of samples from the latent sites in the model.
  
  :param latent: sample from the warped posterior (possibly batched). Note that the
      batch dimension must not collide with plate dimensions in the model, i.e.
      any batch dims `d < - max_plate_nesting`.
  :return: a `dict` of samples keyed by latent sites in the model.
  :rtype: dict
docstr_tok: ["Given","latent","samples","from","the","warped","posterior","(","with","a","possible","batch","dimension",")",",","return","a","`","dict","`","of","samples","from","the","latent","sites","in","the","model",".",":","param","latent",":","sample","from","the","warped","posterior","(","possibly","batched",")",".","Note","that","the","batch","dimension","must","not","collide","with","plate","dimensions","in","the","model",",","i.e",".","any","batch","dims","`","d","<","-","max_plate_nesting","`",".",":","return",":","a","`","dict","`","of","samples","keyed","by","latent","sites","in","the","model",".",":","rtype",":","dict"]
code: def transform_sample(self, latent):
      """
      Given latent samples from the warped posterior (with a possible batch dimension),
      return a `dict` of samples from the latent sites in the model.
  
      :param latent: sample from the warped posterior (possibly batched). Note that the
          batch dimension must not collide with plate dimensions in the model, i.e.
          any batch dims `d < - max_plate_nesting`.
      :return: a `dict` of samples keyed by latent sites in the model.
      :rtype: dict
      """
      x_unconstrained = self.transform(latent)
      transformed_samples = {}
      for site, value in self.guide._unpack_latent(x_unconstrained):
          transform = biject_to(site["fn"].support)
          x_constrained = transform(value)
          transformed_samples[site["name"]] = x_constrained
      return transformed_samples
  
file_path: pyro/pyro/infer/reparam/neutra.py
imports: from contextlib import ExitStack
  from torch.distributions import biject_to
  import pyro
  import pyro.distributions
  from pyro import poutine
  from pyro.distributions.util import sum_rightmost
  from pyro.infer.autoguide.guides import AutoContinuous
  from pyro.poutine.plate_messenger import block_plate
  from .reparam import Reparam
label_desc: Use image node_id 5 for calling the NeuTraReparam obj's underlying member method code with example usage: obj.transform_sample(latent) and returns: transformed_samples