class_docstr: Image to Patch Embedding
      
class_docstr_tok: ["Image","to","Patch","Embedding"]
code: def __init__(
      self,
      img_size=[32, 100],
      in_channels=3,
      embed_dim=768,
      sub_num=2,
      patch_size=[4, 4],
      mode="pope",
  ):
      super().__init__()
      num_patches = (img_size[1] // (2**sub_num)) * (
          img_size[0] // (2**sub_num)
      )
      self.img_size = img_size
      self.num_patches = num_patches
      self.embed_dim = embed_dim
      self.norm = None
      if mode == "pope":
          if sub_num == 2:
              self.proj = nn.Sequential(
                  ConvBNLayer(
                      in_channels=in_channels,
                      out_channels=embed_dim // 2,
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      act=nn.GELU,
                      bias_attr=None,
                  ),
                  ConvBNLayer(
                      in_channels=embed_dim // 2,
                      out_channels=embed_dim,
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      act=nn.GELU,
                      bias_attr=None,
                  ),
              )
          if sub_num == 3:
              self.proj = nn.Sequential(
                  ConvBNLayer(
                      in_channels=in_channels,
                      out_channels=embed_dim // 4,
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      act=nn.GELU,
                      bias_attr=None,
                  ),
                  ConvBNLayer(
                      in_channels=embed_dim // 4,
                      out_channels=embed_dim // 2,
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      act=nn.GELU,
                      bias_attr=None,
                  ),
                  ConvBNLayer(
                      in_channels=embed_dim // 2,
                      out_channels=embed_dim,
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      act=nn.GELU,
                      bias_attr=None,
                  ),
              )
      elif mode == "linear":
          self.proj = nn.Conv2D(
              1, embed_dim, kernel_size=patch_size, stride=patch_size
          )
          self.num_patches = (
              img_size[0]
              // patch_size[0]
              * img_size[1]
              // patch_size[1]
          )
  
imports: from paddle import ParamAttr
  from paddle.nn.initializer import KaimingNormal
  import numpy
  import paddle
  import paddle.nn
  from paddle.nn.initializer import TruncatedNormal, Constant, Normal
label_desc: Use image node_id 1 to create a new PatchEmbed object from inherited base classes: nn with example: obj = PatchEmbed(img_size, in_channels, embed_dim, sub_num, patch_size, mode)