class_docstr: Image to Patch Embedding.
  
  We use a conv layer to implement PatchEmbed.
  
  Args:
      in_channels (int): The num of input channels. Default: 3
      embed_dims (int): The dimensions of embedding. Default: 768
      conv_type (str): The config dict for embedding
          conv layer type selection. Default: "Conv2d.
      kernel_size (int): The kernel_size of embedding conv. Default: 16.
      stride (int): The slide stride of embedding conv.
          Default: None (Would be set as `kernel_size`).
      padding (int | tuple | string ): The padding length of
          embedding conv. When it is a string, it means the mode
          of adaptive padding, support "same" and "corner" now.
          Default: "corner".
      dilation (int): The dilation rate of embedding conv. Default: 1.
      bias (bool): Bias of embed conv. Default: True.
      norm_cfg (dict, optional): Config dict for normalization layer.
          Default: None.
      input_size (int | tuple | None): The size of input, which will be
          used to calculate the out size. Only work when `dynamic_size`
          is False. Default: None.
      init_cfg (`mmengine.ConfigDict`, optional): The Config for
          initialization. Default: None.
class_docstr_tok: ["Image","to","Patch","Embedding",".","We","use","a","conv","layer","to","implement","PatchEmbed",".","Args",":","in_channels","(","int",")",":","The","num","of","input","channels",".","Default",":","3","embed_dims","(","int",")",":","The","dimensions","of","embedding",".","Default",":","768","conv_type","(","str",")",":","The","config","dict","for","embedding","conv","layer","type","selection",".","Default",":","``","Conv2d",".","kernel_size","(","int",")",":","The","kernel_size","of","embedding","conv",".","Default",":","16.","stride","(","int",")",":","The","slide","stride","of","embedding","conv",".","Default",":","None","(","Would","be","set","as","`","kernel_size","`",")",".","padding","(","int","|","tuple","|","string",")",":","The","padding","length","of","embedding","conv",".","When","it","is","a","string",",","it","means","the","mode","of","adaptive","padding",",","support","``","same","''","and","``","corner","''","now",".","Default",":","``","corner","''",".","dilation","(","int",")",":","The","dilation","rate","of","embedding","conv",".","Default",":","1.","bias","(","bool",")",":","Bias","of","embed","conv",".","Default",":","True",".","norm_cfg","(","dict",",","optional",")",":","Config","dict","for","normalization","layer",".","Default",":","None",".","input_size","(","int","|","tuple","|","None",")",":","The","size","of","input",",","which","will","be","used","to","calculate","the","out","size",".","Only","work","when","`","dynamic_size","`","is","False",".","Default",":","None",".","init_cfg","(","`","mmengine.ConfigDict","`",",","optional",")",":","The","Config","for","initialization",".","Default",":","None","."]
docstr: Args:
      x (Tensor): Has shape (B, C, H, W). In most case, C is 3.
  
  Returns:
      tuple: Contains merged results and its spatial shape.
  
          - x (Tensor): Has shape (B, out_h * out_w, embed_dims)
          - out_size (tuple[int]): Spatial shape of x, arrange as
              (out_h, out_w).
code: def forward(self, x: Tensor) -> Tuple[Tensor, Tuple[int]]:
      """
      Args:
          x (Tensor): Has shape (B, C, H, W). In most case, C is 3.
  
      Returns:
          tuple: Contains merged results and its spatial shape.
  
              - x (Tensor): Has shape (B, out_h * out_w, embed_dims)
              - out_size (tuple[int]): Spatial shape of x, arrange as
                  (out_h, out_w).
      """
  
      if self.adap_padding:
          x = self.adap_padding(x)
  
      x = self.projection(x)
      out_size = (x.shape[2], x.shape[3])
      x = x.flatten(2).transpose(1, 2)
      if self.norm is not None:
          x = self.norm(x)
      return x, out_size
  
imports: import math
  import warnings
  from typing import Optional, Sequence, Tuple, Union
  import torch
  import torch.nn.functional
  from mmcv.cnn import Linear, build_activation_layer, build_conv_layer, build_norm_layer
  from mmcv.cnn.bricks.drop import Dropout
  from mmengine.model import BaseModule, ModuleList
  from mmengine.utils import to_2tuple
  from torch import Tensor, nn
  from mmdet.registry import MODELS
  from mmdet.utils import OptConfigType, OptMultiConfig
label_desc: Use image node_id 2 for calling the PatchEmbed obj's underlying member method code with example usage: obj.forward(x) and returns: x,  out_size