allennlp.modules.maxout

A maxout neural network.

class allennlp.modules.maxout.Maxout(input_dim: int, num_layers: int, output_dims: typing.Union[int, typing.Sequence[int]], pool_sizes: typing.Union[int, typing.Sequence[int]], dropout: typing.Union[float, typing.Sequence[float]] = 0.0) → None[source]

Bases: torch.nn.modules.module.Module

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.

forward(inputs: torch.Tensor) → torch.Tensor[source]
classmethod from_params(params: allennlp.common.params.Params)[source]
get_input_dim()[source]
get_output_dim()[source]