class_docstr: An LSTM with Recurrent Dropout and the option to use highway
  connections between layers. Note: this implementation is slower
  than the native Pytorch LSTM because it cannot make use of CUDNN
  optimizations for stacked RNNs due to the highway layers and
  variational dropout.
  
  Parameters
  ----------
  input_size : int, required.
      The dimension of the inputs to the LSTM.
  hidden_size : int, required.
      The dimension of the outputs of the LSTM.
  go_forward: bool, optional (default = True)
      The direction in which the LSTM is applied to the sequence.
      Forwards by default, or backwards if False.
  recurrent_dropout_probability: float, optional (default = 0.0)
      The dropout probability to be used in a dropout scheme as stated in
      `A Theoretically Grounded Application of Dropout in Recurrent Neural Networks
      <https://arxiv.org/abs/1512.05287>`_ . Implementation wise, this simply
      applies a fixed dropout mask per sequence to the recurrent connection of the
      LSTM.
  use_highway: bool, optional (default = True)
      Whether or not to use highway connections between layers. This effectively involves
      reparameterising the normal output of an LSTM as::
  
          gate = sigmoid(W_x1 * x_t + W_h * h_t)
          output = gate * h_t  + (1 - gate) * (W_x2 * x_t)
  use_input_projection_bias : bool, optional (default = True)
      Whether or not to use a bias on the input projection layer. This is mainly here
      for backwards compatibility reasons and will be removed (and set to False)
      in future releases.
  
  Returns
  -------
  output_accumulator : PackedSequence
      The outputs of the LSTM for each timestep. A tensor of shape
      (batch_size, max_timesteps, hidden_size) where for a given batch
      element, all outputs past the sequence length for that batch are
      zero tensors.
code: def __init__(
      self,
      input_size,
      hidden_size,
      go_forward=True,
      recurrent_dropout_probability=0.0,
      use_highway=True,
      use_input_projection_bias=True,
  ):
      super(AugmentedLstm, self).__init__()
      # Required to be wrapped with a :class:`PytorchSeq2SeqWrapper`.
      self.input_size = input_size
      self.hidden_size = hidden_size
  
      self.go_forward = go_forward
      self.use_highway = use_highway
      self.recurrent_dropout_probability = recurrent_dropout_probability
  
      # We do the projections for all the gates all at once, so if we are
      # using highway layers, we need some extra projections, which is
      # why the sizes of the Linear layers change here depending on this flag.
      if use_highway:
          self.input_linearity = torch.nn.Linear(
              input_size,
              6 * hidden_size,
              bias=use_input_projection_bias,
          )
          self.state_linearity = torch.nn.Linear(
              hidden_size, 5 * hidden_size, bias=True
          )
      else:
          self.input_linearity = torch.nn.Linear(
              input_size,
              4 * hidden_size,
              bias=use_input_projection_bias,
          )
          self.state_linearity = torch.nn.Linear(
              hidden_size, 4 * hidden_size, bias=True
          )
      self.reset_parameters()
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/augmented_lstm.py
imports: from __future__ import absolute_import
  import torch
  from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence, PackedSequence
  from allennlp.common.checks import ConfigurationError
  from allennlp.nn.util import get_dropout_mask
  from allennlp.nn.initializers import block_orthogonal
label_desc: Use image node_id 1 to create a new AugmentedLstm object from inherited base classes: torch.nn with example: obj = AugmentedLstm(input_size, hidden_size, go_forward, recurrent_dropout_probability, use_highway, use_input_projection_bias)