class_docstr: An implementation of the deep Neural Autoregressive Flow (NAF) bijective
  transform of the "IAF flavour" that can be used for sampling and scoring samples
  drawn from it (but not arbitrary ones).
  
  Example usage:
  
  >>> from pyro.nn import AutoRegressiveNN
  >>> base_dist = dist.Normal(torch.zeros(10), torch.ones(10))
  >>> arn = AutoRegressiveNN(10, [40], param_dims=[16]*3)
  >>> transform = NeuralAutoregressive(arn, hidden_units=16)
  >>> pyro.module("my_transform", transform)  # doctest: +SKIP
  >>> flow_dist = dist.TransformedDistribution(base_dist, [transform])
  >>> flow_dist.sample()  # doctest: +SKIP
  
  The inverse operation is not implemented. This would require numerical
  inversion, e.g., using a root finding method - a possibility for a future
  implementation.
  
  :param autoregressive_nn: an autoregressive neural network whose forward call
      returns a tuple of three real-valued tensors, whose last dimension is the
      input dimension, and whose penultimate dimension is equal to hidden_units.
  :type autoregressive_nn: nn.Module
  :param hidden_units: the number of hidden units to use in the NAF transformation
      (see Eq (8) in reference)
  :type hidden_units: int
  :param activation: Activation function to use. One of 'ELU', 'LeakyReLU',
      'sigmoid', or 'tanh'.
  :type activation: string
  
  Reference:
  
  [1] Chin-Wei Huang, David Krueger, Alexandre Lacoste, Aaron Courville. Neural
  Autoregressive Flows. [arXiv:1804.00779]
docstr: :param x: the input into the bijection
  :type x: torch.Tensor
  
  Invokes the bijection x=>y; in the prototypical context of a
  :class:`~pyro.distributions.TransformedDistribution` `x` is a sample from
  the base distribution (or the output of a previous transform)
docstr_tok: [":","param","x",":","the","input","into","the","bijection",":","type","x",":","torch.Tensor","Invokes","the","bijection","x=",">","y",";","in","the","prototypical","context","of","a",":","class",":","`","~pyro.distributions.TransformedDistribution","`","`","x","`","is","a","sample","from","the","base","distribution","(","or","the","output","of","a","previous","transform",")"]
code: def _call(self, x):
      """
      :param x: the input into the bijection
      :type x: torch.Tensor
  
      Invokes the bijection x=>y; in the prototypical context of a
      :class:`~pyro.distributions.TransformedDistribution` `x` is a sample from
      the base distribution (or the output of a previous transform)
      """
      # A, W, b ~ batch_shape x hidden_units x event_shape
      A, W_pre, b = self.arn(x)
      T = self.T
  
      # Divide the autoregressive output into the component activations
      A = F.softplus(A)
      C = A * x.unsqueeze(-2) + b
      W = F.softmax(W_pre, dim=-2)
      T_C = T(C)
      D = (W * T_C).sum(dim=-2)
      y = T.inv(D)
  
      self._cached_log_df_inv_dx = T.inv.log_abs_det_jacobian(D, y)
      self._cached_A = A
      self._cached_W_pre = W_pre
      self._cached_C = C
      self._cached_T_C = T_C
  
      return y
  
imports: from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.distributions.transforms import SigmoidTransform, TanhTransform
  from pyro.nn import AutoRegressiveNN, ConditionalAutoRegressiveNN
  from ..None import constraints
  from ..conditional import ConditionalTransformModule
  from ..torch_transform import TransformModule
  from ..util import copy_docs_from
  from .basic import ELUTransform, LeakyReLUTransform
label_desc: Use image node_id 2 for calling the NeuralAutoregressive obj's underlying member method code with example usage: obj._call(x) and returns: y