class_docstr: An LSTM with Recurrent Dropout and a projected and clipped hidden state and
  memory. Note: this implementation is slower than the native Pytorch LSTM because
  it cannot make use of CUDNN optimizations for stacked RNNs due to and
  variational dropout and the custom nature of the cell state.
  
  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.
  cell_size : ``int``, required.
      The dimension of the memory cell used for 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.
  state_projection_clip_value: ``float``, optional, (default = None)
      The magnitude with which to clip the hidden_state after projecting it.
  memory_cell_clip_value: ``float``, optional, (default = None)
      The magnitude with which to clip the memory cell.
  
  Returns
  -------
  output_accumulator : ``torch.FloatTensor``
      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.
  final_state: ``Tuple[torch.FloatTensor, torch.FloatTensor]``
      The final (state, memory) states of the LSTM, with shape
      (1, batch_size, hidden_size) and  (1, batch_size, cell_size)
      respectively. The first dimension is 1 in order to match the Pytorch
      API for returning stacked LSTM states.
code: def __init__(
      self,
      input_size,
      hidden_size,
      cell_size,
      go_forward=True,
      recurrent_dropout_probability=0.0,
      memory_cell_clip_value=None,
      state_projection_clip_value=None,
  ):
      super(LstmCellWithProjection, self).__init__()
      # Required to be wrapped with a :class:`PytorchSeq2SeqWrapper`.
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.cell_size = cell_size
  
      self.go_forward = go_forward
      self.state_projection_clip_value = state_projection_clip_value
      self.memory_cell_clip_value = memory_cell_clip_value
      self.recurrent_dropout_probability = recurrent_dropout_probability
  
      # We do the projections for all the gates all at once.
      self.input_linearity = torch.nn.Linear(
          input_size, 4 * cell_size, bias=False
      )
      self.state_linearity = torch.nn.Linear(
          hidden_size, 4 * cell_size, bias=True
      )
  
      # Additional projection matrix for making the hidden state smaller.
      self.state_projection = torch.nn.Linear(
          cell_size, hidden_size, bias=False
      )
      self.reset_parameters()
  
file_path: magnitude/pymagnitude/third_party/allennlp/modules/lstm_cell_with_projection.py
imports: from __future__ import absolute_import
  import torch
  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 LstmCellWithProjection object from inherited base classes: torch.nn with example: obj = LstmCellWithProjection(input_size, hidden_size, cell_size, go_forward, recurrent_dropout_probability, memory_cell_clip_value, state_projection_clip_value)