class_docstr: Image to Patch Embedding
  Args:
      patch_size (int): Patch token size. Default: 4.
      in_chans (int): Number of input image channels. Default: 3.
      embed_dim (int): Number of linear projection output channels. Default: 96.
      norm_layer (nn.Layer, optional): Normalization layer. Default: None
      use_conv_embed (bool): Whether use overlapped convolution for patch embedding. Default: False
      is_stem (bool): Is the stem block or not. 
class_docstr_tok: ["Image","to","Patch","Embedding","Args",":","patch_size","(","int",")",":","Patch","token","size",".","Default",":","4.","in_chans","(","int",")",":","Number","of","input","image","channels",".","Default",":","3.","embed_dim","(","int",")",":","Number","of","linear","projection","output","channels",".","Default",":","96.","norm_layer","(","nn.Layer",",","optional",")",":","Normalization","layer",".","Default",":","None","use_conv_embed","(","bool",")",":","Whether","use","overlapped","convolution","for","patch","embedding",".","Default",":","False","is_stem","(","bool",")",":","Is","the","stem","block","or","not","."]
code: def forward(self, x):
      _, _, H, W = x.shape
  
      if W % self.patch_size[1] != 0:
          # for 3D tensor: [pad_left, pad_right]
          # for 4D tensor: [pad_left, pad_right, pad_top, pad_bottom]
          x = F.pad(
              x, [0, self.patch_size[1] - W % self.patch_size[1], 0, 0]
          )
          W += W % self.patch_size[1]
      if H % self.patch_size[0] != 0:
          x = F.pad(
              x, [0, 0, 0, self.patch_size[0] - H % self.patch_size[0]]
          )
          H += H % self.patch_size[0]
  
      x = self.proj(x)
      if self.norm is not None:
          _, _, Wh, Ww = x.shape
          x = x.flatten(2).transpose([0, 2, 1])
          x = self.norm(x)
          x = x.transpose([0, 2, 1]).reshape(
              [-1, self.embed_dim, Wh, Ww]
          )
  
      return x
  
imports: import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.modeling.shape_spec import ShapeSpec
  from ppdet.core.workspace import register, serializable
  from .transformer_utils import DropPath, Identity
  from .transformer_utils import add_parameter, to_2tuple
  from .transformer_utils import ones_, zeros_, trunc_normal_
  from .swin_transformer import Mlp
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