docstr: The constructor takes a list of embeddings to be combined.
  
  Args:
      embeddings: a list of token embeddings
      hidden_size: the number of hidden states in the lstm
      rnn_layers: the number of layers for the lstm
      reproject_words: boolean value, indicating whether to reproject the token embeddings in a separate linear layer before putting them into the lstm or not.
      reproject_words_dimension: output dimension of reprojecting token embeddings. If None the same output dimension as before will be taken.
      bidirectional: boolean value, indicating whether to use a bidirectional lstm or not
      dropout: the dropout value to be used
      word_dropout: the word dropout value to be used, if 0.0 word dropout is not used
      locked_dropout: the locked dropout value to be used, if 0.0 locked dropout is not used.
docstr_tok: ["The","constructor","takes","a","list","of","embeddings","to","be","combined",".","Args",":","embeddings",":","a","list","of","token","embeddings","hidden_size",":","the","number","of","hidden","states","in","the","lstm","rnn_layers",":","the","number","of","layers","for","the","lstm","reproject_words",":","boolean","value",",","indicating","whether","to","reproject","the","token","embeddings","in","a","separate","linear","layer","before","putting","them","into","the","lstm","or","not",".","reproject_words_dimension",":","output","dimension","of","reprojecting","token","embeddings",".","If","None","the","same","output","dimension","as","before","will","be","taken",".","bidirectional",":","boolean","value",",","indicating","whether","to","use","a","bidirectional","lstm","or","not","dropout",":","the","dropout","value","to","be","used","word_dropout",":","the","word","dropout","value","to","be","used",",","if","0.0","word","dropout","is","not","used","locked_dropout",":","the","locked","dropout","value","to","be","used",",","if","0.0","locked","dropout","is","not","used","."]
code: def __init__(
      self,
      embeddings: List[TokenEmbeddings],
      hidden_size=128,
      rnn_layers=1,
      reproject_words: bool = True,
      reproject_words_dimension: Optional[int] = None,
      bidirectional: bool = False,
      dropout: float = 0.5,
      word_dropout: float = 0.0,
      locked_dropout: float = 0.0,
  ) -> None:
      """The constructor takes a list of embeddings to be combined.
  
      Args:
          embeddings: a list of token embeddings
          hidden_size: the number of hidden states in the lstm
          rnn_layers: the number of layers for the lstm
          reproject_words: boolean value, indicating whether to reproject the token embeddings in a separate linear layer before putting them into the lstm or not.
          reproject_words_dimension: output dimension of reprojecting token embeddings. If None the same output dimension as before will be taken.
          bidirectional: boolean value, indicating whether to use a bidirectional lstm or not
          dropout: the dropout value to be used
          word_dropout: the word dropout value to be used, if 0.0 word dropout is not used
          locked_dropout: the locked dropout value to be used, if 0.0 locked dropout is not used.
      """
      super().__init__()
  
      self.embeddings: StackedEmbeddings = StackedEmbeddings(
          embeddings=embeddings
      )
  
      self.reproject_words = reproject_words
      self.bidirectional = bidirectional
  
      self.length_of_all_token_embeddings: int = (
          self.embeddings.embedding_length
      )
  
      self.name = "document_lstm"
      self.static_embeddings = False
  
      self.__embedding_length: int = hidden_size
      if self.bidirectional:
          self.__embedding_length *= 4
  
      self.embeddings_dimension: int = (
          self.length_of_all_token_embeddings
      )
      if self.reproject_words and reproject_words_dimension is not None:
          self.embeddings_dimension = reproject_words_dimension
  
      # bidirectional LSTM on top of embedding layer
      self.word_reprojection_map = torch.nn.Linear(
          self.length_of_all_token_embeddings, self.embeddings_dimension
      )
      self.rnn = torch.nn.GRU(
          self.embeddings_dimension,
          hidden_size,
          num_layers=rnn_layers,
          bidirectional=self.bidirectional,
      )
  
      # dropouts
      if locked_dropout > 0.0:
          self.dropout: torch.nn.Module = LockedDropout(locked_dropout)
      else:
          self.dropout = torch.nn.Dropout(dropout)
  
      self.use_word_dropout: bool = word_dropout > 0.0
      if self.use_word_dropout:
          self.word_dropout = WordDropout(word_dropout)
  
      torch.nn.init.xavier_uniform_(self.word_reprojection_map.weight)
  
      self.to(flair.device)
  
imports: import logging
  import re
  from pathlib import Path
  from typing import List, Optional, Union
  import torch
  from deprecated.sphinx import deprecated
  import flair
  from flair.data import Sentence, Token
  from flair.embeddings.document import DocumentEmbeddings
  from flair.embeddings.token import StackedEmbeddings, TokenEmbeddings
  from flair.file_utils import cached_path
  from flair.nn import LockedDropout, WordDropout
label_desc: Use image node_id 1 to create a new DocumentLSTMEmbeddings object from inherited base classes: DocumentEmbeddings with example: obj = DocumentLSTMEmbeddings(embeddings, hidden_size, rnn_layers, reproject_words, reproject_words_dimension, bidirectional, dropout, word_dropout, locked_dropout)