docstr: The constructor takes a list of embeddings to be combined.
  
  Args:
      embeddings: a list of token embeddings
      fine_tune_mode: if set to "linear" a trainable layer is added, if set to "nonlinear", a nonlinearity is added as well. Set this to make the pooling trainable.
      pooling: a string which can any value from ['mean', 'max', 'min']
docstr_tok: ["The","constructor","takes","a","list","of","embeddings","to","be","combined",".","Args",":","embeddings",":","a","list","of","token","embeddings","fine_tune_mode",":","if","set","to","``","linear","''","a","trainable","layer","is","added",",","if","set","to","``","nonlinear","''",",","a","nonlinearity","is","added","as","well",".","Set","this","to","make","the","pooling","trainable",".","pooling",":","a","string","which","can","any","value","from","[","'mean","'",",","'max","'",",","'min","'","]"]
code: def __init__(
      self,
      embeddings: Union[TokenEmbeddings, List[TokenEmbeddings]],
      fine_tune_mode: str = "none",
      pooling: str = "mean",
  ) -> None:
      """The constructor takes a list of embeddings to be combined.
  
      Args:
          embeddings: a list of token embeddings
          fine_tune_mode: if set to "linear" a trainable layer is added, if set to "nonlinear", a nonlinearity is added as well. Set this to make the pooling trainable.
          pooling: a string which can any value from ['mean', 'max', 'min']
      """
      super().__init__()
  
      if isinstance(embeddings, StackedEmbeddings):
          embeddings = embeddings.embeddings
      elif isinstance(embeddings, TokenEmbeddings):
          embeddings = [embeddings]
  
      self.embeddings: StackedEmbeddings = StackedEmbeddings(
          embeddings=embeddings
      )
      self.__embedding_length = self.embeddings.embedding_length
  
      # optional fine-tuning on top of embedding layer
      self.fine_tune_mode = fine_tune_mode
      if self.fine_tune_mode in ["nonlinear", "linear"]:
          self.embedding_flex = torch.nn.Linear(
              self.embedding_length, self.embedding_length, bias=False
          )
          self.embedding_flex.weight.data.copy_(
              torch.eye(self.embedding_length)
          )
  
      if self.fine_tune_mode in ["nonlinear"]:
          self.embedding_flex_nonlinear = torch.nn.ReLU()
          self.embedding_flex_nonlinear_map = torch.nn.Linear(
              self.embedding_length, self.embedding_length
          )
  
      self.__embedding_length = self.embeddings.embedding_length
  
      self.to(flair.device)
  
      if pooling not in ["min", "max", "mean"]:
          raise ValueError(
              f"Pooling operation for {self.mode!r} is not defined"
          )
  
      self.pooling = pooling
      self.name: str = f"document_{self.pooling}"
  
      self.eval()
  
imports: import logging
  from typing import Any, Dict, List, Optional, Union, cast
  import torch
  from sklearn.feature_extraction.text import TfidfVectorizer
  from torch.nn import RNNBase
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
  import flair
  from flair.data import Sentence
  from flair.embeddings.base import DocumentEmbeddings, load_embeddings, register_embeddings
  from flair.embeddings.token import FlairEmbeddings, StackedEmbeddings, TokenEmbeddings
  from flair.embeddings.transformer import TransformerEmbeddings, TransformerOnnxDocumentEmbeddings
  from flair.nn import LockedDropout, WordDropout
label_desc: Use image node_id 1 to create a new DocumentPoolEmbeddings object from inherited base classes: DocumentEmbeddings with example: obj = DocumentPoolEmbeddings(embeddings, fine_tune_mode, pooling)