class_docstr: 2D Image to Patch Embedding
class_docstr_tok: ["2D","Image","to","Patch","Embedding"]
code: def forward(self, x):
      _, _, H, W = x.shape
  
      # padding
      # 如果输入图片的H，W不是patch_size的整数倍，需要进行padding
      pad_input = (H % self.patch_size[0] != 0) or (
          W % self.patch_size[1] != 0
      )
      if pad_input:
          # to pad the last 3 dimensions,
          # (W_left, W_right, H_top,H_bottom, C_front, C_back)
          x = F.pad(
              x,
              (
                  0,
                  self.patch_size[1] - W % self.patch_size[1],
                  0,
                  self.patch_size[0] - H % self.patch_size[0],
                  0,
                  0,
              ),
          )
  
      # 下采样patch_size倍
      x = self.proj(x)
      _, _, H, W = x.shape
      # flatten: [B, C, H, W] -> [B, C, HW]
      # transpose: [B, C, HW] -> [B, HW, C]
      x = x.flatten(2).transpose(1, 2)
      x = self.norm(x)
      return x, H, W
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  import numpy
  from typing import Optional
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,  H,  W