code: def neural_autoregressive(
      input_dim, hidden_dims=None, activation="sigmoid", width=16
  ):
      """
      A helper function to create a
      :class:`~pyro.distributions.transforms.NeuralAutoregressive` object that takes
      care of constructing an autoregressive network with the correct input/output
      dimensions.
  
      :param input_dim: Dimension of input variable
      :type input_dim: int
      :param hidden_dims: The desired hidden dimensions of the autoregressive network.
          Defaults to using [3*input_dim + 1]
      :type hidden_dims: list[int]
      :param activation: Activation function to use. One of 'ELU', 'LeakyReLU',
          'sigmoid', or 'tanh'.
      :type activation: string
      :param width: The width of the "multilayer perceptron" in the transform (see
          paper). Defaults to 16
      :type width: int
  
      """
  
      if hidden_dims is None:
          hidden_dims = [3 * input_dim + 1]
      arn = AutoRegressiveNN(
          input_dim, hidden_dims, param_dims=[width] * 3
      )
      return NeuralAutoregressive(
          arn, hidden_units=width, activation=activation
      )
  
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 1 for calling a global function with example usage: neural_autoregressive(input_dim, hidden_dims, activation, width) and returns: NeuralAutoregressive