class_docstr: A MLP block that contains two linear layers with a normalization layer.
  the MLP block is used in a transformer model after the attention block.
  ::
                                      Input
                                         ↓
                                      Reshape
                                         ↓
                                        Pool
                                         ↓
                                      Reshape
                                         ↓
                                        norm
  Args:
      thw_shape (`List[int]`):
          the shape of the input tensor (before flattening).
      pool (`Callable`):
          Pool operation that is applied to the input tensor.
          If pool is None, return the input tensor.
      has_cls_embed (`bool`):
          whether the input tensor contains cls token. Pool operation excludes cls token.
      norm (`Callable`):
          Optional normalization operation applied to tensor after pool.
  Returns:
      tensor (`torch.Tensor`):
          Input tensor after pool.
      thw_shape (`List[int]`):
          Output tensor shape (before flattening).
class_docstr_tok: ["A","MLP","block","that","contains","two","linear","layers","with","a","normalization","layer",".","the","MLP","block","is","used","in","a","transformer","model","after","the","attention","block",".",":",":","Input","\u2193","Reshape","\u2193","Pool","\u2193","Reshape","\u2193","norm","Args",":","thw_shape","(","`","List","[","int","]","`",")",":","the","shape","of","the","input","tensor","(","before","flattening",")",".","pool","(","`","Callable","`",")",":","Pool","operation","that","is","applied","to","the","input","tensor",".","If","pool","is","None",",","return","the","input","tensor",".","has_cls_embed","(","`","bool","`",")",":","whether","the","input","tensor","contains","cls","token",".","Pool","operation","excludes","cls","token",".","norm","(","`","Callable","`",")",":","Optional","normalization","operation","applied","to","tensor","after","pool",".","Returns",":","tensor","(","`","torch.Tensor","`",")",":","Input","tensor","after","pool",".","thw_shape","(","`","List","[","int","]","`",")",":","Output","tensor","shape","(","before","flattening",")","."]
code: def __init__(self, pool=None, has_cls_embed=True, norm=None) -> None:
      super().__init__()
      self.pool = pool
      self.has_cls_embed = has_cls_embed
      self.norm = norm
      self.tensor_dim = 4
  
imports: import math
  from functools import partial
  from typing import Tuple, List
  import numpy
  import torch
  from torch import nn
  from torch.nn.init import trunc_normal_
  from einops import rearrange
  from towhee.models.layers.layers_with_relprop import GELU, Linear, Dropout, Conv2d, Conv3d, Softmax, Sigmoid, LayerNorm, Einsum, Add, Clone, MaxPool3d, IndexSelect
label_desc: Use image node_id 1 to create a new AttentionPool object from inherited base classes: nn with example: obj = AttentionPool(pool, has_cls_embed, norm)