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","."]
code: def __init__(
      self,
      input_size: int,
      hidden_size: int,
      num_layers: int = 1,
      bias: bool = True,
      recurrent_dropout_probability: float = 0.0,
      bidirectional: bool = False,
      padding_value: float = 0.0,
      use_highway: bool = True,
  ) -> None:
      super().__init__()
      self.input_size = input_size
      self.padding_value = padding_value
      self.hidden_size = hidden_size
      self.num_layers = num_layers
      self.bidirectional = bidirectional
      self.recurrent_dropout_probability = recurrent_dropout_probability
      self.use_highway = use_highway
      self.use_bias = bias
  
      num_directions = int(self.bidirectional) + 1
      self.forward_layers = torch.nn.ModuleList()
      if self.bidirectional:
          self.backward_layers = torch.nn.ModuleList()
  
      lstm_embed_dim = self.input_size
      for _ in range(self.num_layers):
          self.forward_layers.append(
              AugmentedLstm(
                  lstm_embed_dim,
                  self.hidden_size,
                  go_forward=True,
                  recurrent_dropout_probability=self.recurrent_dropout_probability,
                  use_highway=self.use_highway,
                  use_input_projection_bias=self.use_bias,
              )
          )
          if self.bidirectional:
              self.backward_layers.append(
                  AugmentedLstm(
                      lstm_embed_dim,
                      self.hidden_size,
                      go_forward=False,
                      recurrent_dropout_probability=self.recurrent_dropout_probability,
                      use_highway=self.use_highway,
                      use_input_projection_bias=self.use_bias,
                  )
              )
  
          lstm_embed_dim = self.hidden_size * num_directions
      self.representation_dim = lstm_embed_dim
  
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 1 to create a new BiAugmentedLstm object from inherited base classes: torch.nn with example: obj = BiAugmentedLstm(input_size, hidden_size, num_layers, bias, recurrent_dropout_probability, bidirectional, padding_value, use_highway)