class_docstr: `BiAugmentedLstm` implements a generic AugmentedLSTM representation layer.
  BiAugmentedLstm is an LSTM which optionally appends an optional highway network to the output layer.
  Furthermore the dropout controls the level of variational dropout done.
  
  # 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`
      Number of recurrent layers. Eg. setting `num_layers=2`
      would mean stacking two LSTMs together to form a stacked LSTM,
      with the second LSTM taking in the outputs of the first LSTM and
      computing the final result. Defaults to 1.
  bias : `bool`
      If `True` we use a bias in our LSTM calculations, otherwise we don't.
  recurrent_dropout_probability : `float`, optional (default = `0.0`)
      Variational dropout probability to use.
  bidirectional : `bool`
      If `True`, becomes a bidirectional LSTM. Defaults to `True`.
  padding_value : `float`, optional (default = `0.0`)
      Value for the padded elements. Defaults to 0.0.
  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)
  
  # 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.
class_docstr_tok: ["`","BiAugmentedLstm","`","implements","a","generic","AugmentedLSTM","representation","layer",".","BiAugmentedLstm","is","an","LSTM","which","optionally","appends","an","optional","highway","network","to","the","output","layer",".","Furthermore","the","dropout","controls","the","level","of","variational","dropout","done",".","#","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","`","Number","of","recurrent","layers",".","Eg",".","setting","`","num_layers=2","`","would","mean","stacking","two","LSTMs","together","to","form","a","stacked","LSTM",",","with","the","second","LSTM","taking","in","the","outputs","of","the","first","LSTM","and","computing","the","final","result",".","Defaults","to","1.","bias",":","`","bool","`","If","`","True","`","we","use","a","bias","in","our","LSTM","calculations",",","otherwise","we","do","n't",".","recurrent_dropout_probability",":","`","float","`",",","optional","(","default","=","`","0.0","`",")","Variational","dropout","probability","to","use",".","bidirectional",":","`","bool","`","If","`","True","`",",","becomes","a","bidirectional","LSTM",".","Defaults","to","`","True","`",".","padding_value",":","`","float","`",",","optional","(","default","=","`","0.0","`",")","Value","for","the","padded","elements",".","Defaults","to","0.0.","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",")","#","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","."]
docstr: Given an input batch of sequential data such as word embeddings, produces
  a AugmentedLSTM representation of the sequential input and new state
  tensors.
  
  # Parameters
  
  inputs : `PackedSequence`, required.
      A tensor of shape (batch_size, num_timesteps, input_size)
      to apply the LSTM over.
  states : `Tuple[torch.Tensor, torch.Tensor]`
      Tuple of tensors containing
      the initial hidden state and the cell state of each element in
      the batch. Each of these tensors have a dimension of
      (bsize x num_layers x num_directions * nhid). Defaults to `None`.
  
  # Returns
  
  `Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]`
      AgumentedLSTM representation of input and
      the state of the LSTM `t = seq_len`.
      Shape of representation is (bsize x seq_len x representation_dim).
      Shape of each state is (bsize x num_layers * num_directions x nhid).
docstr_tok: ["Given","an","input","batch","of","sequential","data","such","as","word","embeddings",",","produces","a","AugmentedLSTM","representation","of","the","sequential","input","and","new","state","tensors",".","#","Parameters","inputs",":","`","PackedSequence","`",",","required",".","A","tensor","of","shape","(","batch_size",",","num_timesteps",",","input_size",")","to","apply","the","LSTM","over",".","states",":","`","Tuple","[","torch.Tensor",",","torch.Tensor","]","`","Tuple","of","tensors","containing","the","initial","hidden","state","and","the","cell","state","of","each","element","in","the","batch",".","Each","of","these","tensors","have","a","dimension","of","(","bsize","x","num_layers","x","num_directions","*","nhid",")",".","Defaults","to","`","None","`",".","#","Returns","`","Tuple","[","torch.Tensor",",","Tuple","[","torch.Tensor",",","torch.Tensor","]","]","`","AgumentedLSTM","representation","of","input","and","the","state","of","the","LSTM","`","t","=","seq_len","`",".","Shape","of","representation","is","(","bsize","x","seq_len","x","representation_dim",")",".","Shape","of","each","state","is","(","bsize","x","num_layers","*","num_directions","x","nhid",")","."]
code: def forward(
      self,
      inputs: torch.Tensor,
      states: Optional[Tuple[torch.Tensor, torch.Tensor]] = None,
  ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]:
      """
      Given an input batch of sequential data such as word embeddings, produces
      a AugmentedLSTM representation of the sequential input and new state
      tensors.
  
      # Parameters
  
      inputs : `PackedSequence`, required.
          A tensor of shape (batch_size, num_timesteps, input_size)
          to apply the LSTM over.
      states : `Tuple[torch.Tensor, torch.Tensor]`
          Tuple of tensors containing
          the initial hidden state and the cell state of each element in
          the batch. Each of these tensors have a dimension of
          (bsize x num_layers x num_directions * nhid). Defaults to `None`.
  
      # Returns
  
      `Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor]]`
          AgumentedLSTM representation of input and
          the state of the LSTM `t = seq_len`.
          Shape of representation is (bsize x seq_len x representation_dim).
          Shape of each state is (bsize x num_layers * num_directions x nhid).
  
      """
  
      if not isinstance(inputs, PackedSequence):
          raise ConfigurationError(
              "inputs must be PackedSequence but got %s"
              % (type(inputs))
          )
  
      # if states is not None:
      #    states = (states[0].transpose(0, 1), states[1].transpose(0, 1))
      if self.bidirectional:
          return self._forward_bidirectional(inputs, states)
      return self._forward_unidirectional(inputs, states)
  
imports: from typing import Optional, Tuple
  import torch
  from allennlp.common.checks import ConfigurationError
  from torch.nn.utils.rnn import PackedSequence, pack_padded_sequence, pad_packed_sequence
  from allennlp.nn.initializers import block_orthogonal
  from allennlp.nn.util import get_dropout_mask
label_desc: Use image node_id 2 for calling the BiAugmentedLstm obj's underlying member method code with example usage: obj.forward(inputs, states) and returns: self, self