class_docstr: Patch Merging Layer.
      
docstr: Args:
      dim (int): Number of input channels.
      out_dim (int): Number of output channels (or 2 * dim if None)
      norm_layer (nn.Module, optional): Normalization layer.  Default: nn.LayerNorm
docstr_tok: ["Args",":","dim","(","int",")",":","Number","of","input","channels",".","out_dim","(","int",")",":","Number","of","output","channels","(","or","2","*","dim","if","None",")","norm_layer","(","nn.Module",",","optional",")",":","Normalization","layer",".","Default",":","nn.LayerNorm"]
code: def __init__(
      self,
      dim: int,
      out_dim: Optional[int] = None,
      norm_layer: nn.Module = nn.LayerNorm,
  ) -> None:
      """
      Args:
          dim (int): Number of input channels.
          out_dim (int): Number of output channels (or 2 * dim if None)
          norm_layer (nn.Module, optional): Normalization layer.  Default: nn.LayerNorm
      """
      super().__init__()
      self.dim = dim
      self.out_dim = out_dim or 2 * dim
      self.reduction = nn.Linear(4 * dim, self.out_dim, bias=False)
      self.norm = norm_layer(self.out_dim)
  
imports: import math
  from typing import Callable, Optional, Tuple, Union, Set, Dict
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, to_2tuple, trunc_normal_, _assert, ClassifierHead, resample_patch_embed
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._registry import generate_default_cfgs, register_model, register_model_deprecations
label_desc: Use image node_id 1 to create a new PatchMerging object from inherited base classes: nn with example: obj = PatchMerging(dim, out_dim, norm_layer)