class_docstr: BiLSTM is an variant of the vanilla bidirectional LSTM adopted by Biaffine Parser
  with the only difference of the dropout strategy.
  It drops nodes in the LSTM layers (input and recurrent connections)
  and applies the same dropout mask at every recurrent timesteps.
  
  APIs are roughly the same as :class:`~torch.nn.LSTM` except that we remove the ``bidirectional`` option
  and only allows :class:`~torch.nn.utils.rnn.PackedSequence` as input.
  
  References:
      - Timothy Dozat and Christopher D. Manning. 2017.
        `Deep Biaffine Attention for Neural Dependency Parsing`_.
  
  Args:
      input_size (int):
          The number of expected features in the input.
      hidden_size (int):
          The number of features in the hidden state `h`.
      num_layers (int):
          The number of recurrent layers. Default: 1.
      dropout (float):
          If non-zero, introduces a :class:`SharedDropout` layer on the outputs of each LSTM layer except the last layer.
          Default: 0.
  
  .. _Deep Biaffine Attention for Neural Dependency Parsing:
      https://openreview.net/forum?id=Hk95PK9le
class_docstr_tok: ["BiLSTM","is","an","variant","of","the","vanilla","bidirectional","LSTM","adopted","by","Biaffine","Parser","with","the","only","difference","of","the","dropout","strategy",".","It","drops","nodes","in","the","LSTM","layers","(","input","and","recurrent","connections",")","and","applies","the","same","dropout","mask","at","every","recurrent","timesteps",".","APIs","are","roughly","the","same","as",":","class",":","`","~torch.nn.LSTM","`","except","that","we","remove","the","``","bidirectional","``","option","and","only","allows",":","class",":","`","~torch.nn.utils.rnn.PackedSequence","`","as","input",".","References",":","-","Timothy","Dozat","and","Christopher","D.","Manning",".","2017",".","`","Deep","Biaffine","Attention","for","Neural","Dependency","Parsing","`","_",".","Args",":","input_size","(","int",")",":","The","number","of","expected","features","in","the","input",".","hidden_size","(","int",")",":","The","number","of","features","in","the","hidden","state","`","h","`",".","num_layers","(","int",")",":","The","number","of","recurrent","layers",".","Default",":","1.","dropout","(","float",")",":","If","non-zero",",","introduces","a",":","class",":","`","SharedDropout","`","layer","on","the","outputs","of","each","LSTM","layer","except","the","last","layer",".","Default",":","0",".","..","_Deep","Biaffine","Attention","for","Neural","Dependency","Parsing",":","https",":","\/\/openreview.net\/forum","?","id=Hk95PK9le"]
code: def __init__(self, input_size, hidden_size, num_layers=1, dropout=0):
      super().__init__()
  
      self.input_size = input_size
      self.hidden_size = hidden_size
      self.num_layers = num_layers
      self.dropout = dropout
  
      self.f_cells = nn.ModuleList()
      self.b_cells = nn.ModuleList()
      for _ in range(self.num_layers):
          self.f_cells.append(
              nn.LSTMCell(
                  input_size=input_size, hidden_size=hidden_size
              )
          )
          self.b_cells.append(
              nn.LSTMCell(
                  input_size=input_size, hidden_size=hidden_size
              )
          )
          input_size = hidden_size * 2
  
      self.reset_parameters()
  
imports: import torch
  import torch.nn
  from torch.nn.utils.rnn import pack_padded_sequence, PackedSequence
  from torch.nn.modules.rnn import apply_permutation
label_desc: Use image node_id 1 to create a new BiLSTM object from inherited base classes: nn with example: obj = BiLSTM(input_size, hidden_size, num_layers, dropout)