docstr: Apply pool to a flattened input (given pool operation and the unflattened shape).
  
  
                                   Input
                                     ↓
                                  Reshape
                                     ↓
                                    Pool
                                     ↓
                                  Reshape
                                     ↓
                                    Norm
  
  
  Params:
      pool (Optional[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: (Optional[Callable]): Optional normalization operation applied to
      tensor after pool.
docstr_tok: ["Apply","pool","to","a","flattened","input","(","given","pool","operation","and","the","unflattened","shape",")",".","Input","\u2193","Reshape","\u2193","Pool","\u2193","Reshape","\u2193","Norm","Params",":","pool","(","Optional","[","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",":","(","Optional","[","Callable","]",")",":","Optional","normalization","operation","applied","to","tensor","after","pool","."]
code: def __init__(
      self,
      pool: Optional[torch.nn.Module],
      has_cls_embed: bool,
      norm: Optional[torch.nn.Module],
  ) -> None:
      """Apply pool to a flattened input (given pool operation and the unflattened shape).
  
  
                                       Input
                                         ↓
                                      Reshape
                                         ↓
                                        Pool
                                         ↓
                                      Reshape
                                         ↓
                                        Norm
  
  
      Params:
          pool (Optional[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: (Optional[Callable]): Optional normalization operation applied to
          tensor after pool.
      """
      super().__init__()
      self.has_pool = pool is not None
      self.pool = pool if pool is not None else torch.nn.Identity()
  
      self.has_cls_embed = has_cls_embed
      if norm is not None:
          self.norm_before_pool = isinstance(
              norm, (torch.nn.BatchNorm3d, torch.nn.Identity)
          )
          self.has_norm = True
          self.norm = norm
      else:
          self.norm_before_pool = False
          self.has_norm = False
          self.norm = torch.nn.Identity()
  
imports: from typing import Callable, List, Optional, Tuple
  import numpy
  import torch
  import torch.nn
  from torch.nn.common_types import _size_3_t
  from .drop_path import DropPath
label_desc: Use image node_id 1 to create a new _AttentionPool object from inherited base classes: torch.nn with example: obj = _AttentionPool(pool, has_cls_embed, norm)