class_docstr: An implementation of a simple dense feedforward network taking a context variable, for use in, e.g.,
  some conditional flows such as :class:`pyro.distributions.transforms.ConditionalAffineCoupling`.
  
  Example usage:
  
  >>> input_dim = 10
  >>> context_dim = 5
  >>> x = torch.rand(100, input_dim)
  >>> z = torch.rand(100, context_dim)
  >>> nn = ConditionalDenseNN(input_dim, context_dim, [50], param_dims=[1, input_dim, input_dim])
  >>> a, b, c = nn(x, context=z)  # parameters of size (100, 1), (100, 10), (100, 10)
  
  :param input_dim: the dimensionality of the input
  :type input_dim: int
  :param context_dim: the dimensionality of the context variable
  :type context_dim: int
  :param hidden_dims: the dimensionality of the hidden units per layer
  :type hidden_dims: list[int]
  :param param_dims: shape the output into parameters of dimension (p_n,) for p_n in param_dims
      when p_n > 1 and dimension () when p_n == 1. The default is [1, 1], i.e. output two parameters of dimension ().
  :type param_dims: list[int]
  :param nonlinearity: The nonlinearity to use in the feedforward network such as torch.nn.ReLU(). Note that no
      nonlinearity is applied to the final network output, so the output is an unbounded real number.
  :type nonlinearity: torch.nn.Module
docstr: The forward method
code: def _forward(self, x):
      """
      The forward method
      """
      h = x
      for layer in self.layers[:-1]:
          h = self.f(layer(h))
      h = self.layers[-1](h)
  
      # Shape the output, squeezing the parameter dimension if all ones
      if self.output_multiplier == 1:
          return h
      else:
          h = h.reshape(list(x.size()[:-1]) + [self.output_multiplier])
  
          if self.count_params == 1:
              return h
  
          else:
              return tuple([h[..., s] for s in self.param_slices])
  
file_path: pyro/pyro/nn/dense_nn.py
imports: import torch
label_desc: Use image node_id 3 for calling the ConditionalDenseNN obj's underlying member method code with example usage: obj._forward(x) and returns: h, h, tuple