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
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"]
docstr: Forward function.
docstr_tok: ["Forward","function","."]
code: def forward(self, x):
      """Forward function."""
      # padding
      _, _, H, W = x.shape
      if W % self.patch_size[1] != 0:
          x = F.pad(
              x, [0, self.patch_size[1] - W % self.patch_size[1], 0, 0]
          )
      if H % self.patch_size[0] != 0:
          x = F.pad(
              x, [0, 0, 0, self.patch_size[0] - H % self.patch_size[0]]
          )
  
      x = self.proj(x)  # B C Wh Ww
      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 paddle
  import paddle.nn
  import paddle.nn.functional
  import numpy
  from paddleseg.cvlibs import manager
  from paddleseg.utils import utils
  from paddleseg.models.backbones.transformer_utils import *
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