class_docstr: This layers applies global pooling over a 4D or 5D input tensor
  
  Args:
      pool_type (Optional[str]): Pooling type. It can be mean, rms, or abs. Default: `mean`
      keep_dim (Optional[bool]): Do not squeeze the dimensions of a tensor. Default: `False`
  
  Shape:
      - Input: :math:`(N, C, H, W)` or :math:`(N, C, D, H, W)`
      - Output: :math:`(N, C, 1, 1)` or :math:`(N, C, 1, 1, 1)` if keep_dim else :math:`(N, C)`
class_docstr_tok: ["This","layers","applies","global","pooling","over","a","4D","or","5D","input","tensor","Args",":","pool_type","(","Optional","[","str","]",")",":","Pooling","type",".","It","can","be","mean",",","rms",",","or","abs",".","Default",":","`","mean","`","keep_dim","(","Optional","[","bool","]",")",":","Do","not","squeeze","the","dimensions","of","a","tensor",".","Default",":","`","False","`","Shape",":","-","Input",":",":","math",":","`","(","N",",","C",",","H",",","W",")","`","or",":","math",":","`","(","N",",","C",",","D",",","H",",","W",")","`","-","Output",":",":","math",":","`","(","N",",","C",",","1",",","1",")","`","or",":","math",":","`","(","N",",","C",",","1",",","1",",","1",")","`","if","keep_dim","else",":","math",":","`","(","N",",","C",")","`"]
code: def __init__(
      self,
      pool_type: Optional[str] = "mean",
      keep_dim: Optional[bool] = False,
      *args,
      **kwargs,
  ) -> None:
      super().__init__()
      if pool_type not in self.pool_types:
          logger.error(
              "Supported pool types are: {}. Got {}".format(
                  self.pool_types, pool_type
              )
          )
      self.pool_type = pool_type
      self.keep_dim = keep_dim
  
file_path: ml-cvnets/cvnets/layers/global_pool.py
imports: import argparse
  from typing import List, Optional
  import torch
  from torch import Tensor
  from cvnets.layers.base_layer import BaseLayer
  from utils import logger
label_desc: Use image node_id 1 to create a new GlobalPool object from inherited base classes: BaseLayer with example: obj = GlobalPool(pool_type, keep_dim)