class_docstr: A stacked LSTM with LSTM layers which alternate between going forwards over
  the sequence and going backwards. This implementation is based on the
  description in [Deep Semantic Role Labeling - What works and what's next][0].
  
  [0]: https://www.aclweb.org/anthology/P17-1044.pdf
  [1]: https://arxiv.org/abs/1512.05287
  
  # 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.
  num_layers : `int`, required
      The number of stacked LSTMs to use.
  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][1].
  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 interleaved LSTMs per 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: int,
      hidden_size: int,
      num_layers: int,
      recurrent_dropout_probability: float = 0.0,
      use_highway: bool = True,
      use_input_projection_bias: bool = True,
  ) -> None:
      super().__init__()
  
      # Required to be wrapped with a `PytorchSeq2SeqWrapper`.
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.num_layers = num_layers
  
      layers = []
      lstm_input_size = input_size
      for layer_index in range(num_layers):
          go_forward = layer_index % 2 == 0
          layer = AugmentedLstm(
              lstm_input_size,
              hidden_size,
              go_forward,
              recurrent_dropout_probability=recurrent_dropout_probability,
              use_highway=use_highway,
              use_input_projection_bias=use_input_projection_bias,
          )
          lstm_input_size = hidden_size
          self.add_module("layer_{}".format(layer_index), layer)
          layers.append(layer)
      self.lstm_layers = layers
  
file_path: allennlp/allennlp/modules/stacked_alternating_lstm.py
imports: from typing import Optional, Tuple, Union, List
  import torch
  from torch.nn.utils.rnn import PackedSequence
  from allennlp.modules.augmented_lstm import AugmentedLstm
  from allennlp.common.checks import ConfigurationError
label_desc: Use image node_id 1 to create a new StackedAlternatingLstm object from inherited base classes: torch.nn with example: obj = StackedAlternatingLstm(input_size, hidden_size, num_layers, recurrent_dropout_probability, use_highway, use_input_projection_bias)