class_docstr: pooling (e.g. max pooling or self attention)
  followed by optional MLP
class_docstr_tok: ["pooling","(","e.g",".","max","pooling","or","self","attention",")","followed","by","optional","MLP"]
docstr: embed_dim is the dimension of embedded_tokens
docstr_tok: ["embed_dim","is","the","dimension","of","embedded_tokens"]
code: def __init__(self, config: Config, embed_dim: int) -> None:
      """embed_dim is the dimension of embedded_tokens"""
      super().__init__(config)
  
      self.dropout = nn.Dropout(config.dropout)
  
      # Document attention.
      self.attention = (
          create_module(config.pooling, n_input=embed_dim)
          if config.pooling is not None
          else None
      )
  
      # Non-linear projection over attended representation.
      self.dense = None
      if (
          isinstance(config.pooling, BoundaryPool.Config)
          and config.pooling.boundary_type == "firstlast"
      ):
          # the dimension double because of concatenating bos and eos
          self.representation_dim = embed_dim * 2
      else:
          self.representation_dim = embed_dim
  
      if config.mlp_decoder:
          self.dense = MLPDecoder(config.mlp_decoder, in_dim=embed_dim)
          self.representation_dim = self.dense.out_dim
      log_class_usage(__class__)
  
file_path: pytext/pytext/models/representations/pure_doc_attention.py
imports: from typing import Any, Optional, Union
  import torch
  import torch.nn
  from pytext.config import ConfigBase
  from pytext.models.decoders.mlp_decoder import MLPDecoder
  from pytext.models.module import create_module
  from pytext.utils.usage import log_class_usage
  from .pooling import BoundaryPool, MaxPool, MeanPool, NoPool, SelfAttention
  from .representation_base import RepresentationBase
label_desc: Use image node_id 1 to create a new PureDocAttention object from inherited base classes: RepresentationBase with example: obj = PureDocAttention(config, embed_dim)