class_docstr: This ``Module`` is a maxout neural network.
  
  Parameters
  ----------
  input_dim : ``int``
      The dimensionality of the input.  We assume the input has shape ``(batch_size, input_dim)``.
  num_layers : ``int``
      The number of maxout layers to apply to the input.
  output_dims : ``Union[int, Sequence[int]]``
      The output dimension of each of the maxout layers.  If this is a single ``int``, we use
      it for all maxout layers.  If it is a ``Sequence[int]``, ``len(output_dims)`` must be
      ``num_layers``.
  pool_sizes : ``Union[int, Sequence[int]]``
      The size of max-pools.  If this is a single ``int``, we use
      it for all maxout layers.  If it is a ``Sequence[int]``, ``len(pool_sizes)`` must be
      ``num_layers``.
  dropout : ``Union[float, Sequence[float]]``, optional
      If given, we will apply this amount of dropout after each layer.  Semantics of ``float``
      versus ``Sequence[float]`` is the same as with other parameters.
code: def __init__(
      self, input_dim, num_layers, output_dims, pool_sizes, dropout=0.0
  ):
      super(Maxout, self).__init__()
      if not isinstance(output_dims, list):
          output_dims = [output_dims] * num_layers  # type: ignore
      if not isinstance(pool_sizes, list):
          pool_sizes = [pool_sizes] * num_layers  # type: ignore
      if not isinstance(dropout, list):
          dropout = [dropout] * num_layers  # type: ignore
      if len(output_dims) != num_layers:
          raise ConfigurationError(
              "len(output_dims) (%d) != num_layers (%d)"
              % (len(output_dims), num_layers)
          )
      if len(pool_sizes) != num_layers:
          raise ConfigurationError(
              "len(pool_sizes) (%d) != num_layers (%d)"
              % (len(pool_sizes), num_layers)
          )
      if len(dropout) != num_layers:
          raise ConfigurationError(
              "len(dropout) (%d) != num_layers (%d)"
              % (len(dropout), num_layers)
          )
  
      self._pool_sizes = pool_sizes
      input_dims = [input_dim] + output_dims[:-1]
      linear_layers = []
      for layer_input_dim, layer_output_dim, pool_size in izip(
          input_dims, output_dims, pool_sizes
      ):
          linear_layers.append(
              torch.nn.Linear(
                  layer_input_dim, layer_output_dim * pool_size
              )
          )
      self._linear_layers = torch.nn.ModuleList(linear_layers)
      dropout_layers = [torch.nn.Dropout(p=value) for value in dropout]
      self._dropout = torch.nn.ModuleList(dropout_layers)
      self._output_dims = output_dims
      self._output_dim = output_dims[-1]
      self._input_dim = input_dim
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/maxout.py
imports: from __future__ import absolute_import
  import torch
  from allennlp.common.checks import ConfigurationError
  from allennlp.common.registrable import FromParams
label_desc: Use image node_id 1 to create a new Maxout object from inherited base classes: torch.nn, FromParams with example: obj = Maxout(input_dim, num_layers, output_dims, pool_sizes, dropout)