class_docstr: 2D Image to Patch Embedding
  
  Args:
      img_size (`int=224`):
          image height (should be equal to width)
      patch_size (`int=16`):
          patch height (should be equal to width)
      in_chans (`int=3`):
          the number of image channels
      embed_dim (`int=768`):
          embedding dimension
      norm_layer (`nn.Module=None`):
          normalization layer
      flatten (`bool=True`):
          if flat output
  
  Example:
      >>> import torch
      >>> from towhee.models.layers.patch_embed2d import PatchEmbed2D
      >>>
      >>> test_shape1 = (1, 3, 224, 224)
      >>> test_shape2 = (1, 3, 5, 224, 224)
      >>> fake_img = torch.rand(test_shape1)
      >>> fake_video = torch.rand(test_shape2)
      >>> model = PatchEmbed2D()
      >>> out1 = model(fake_img)
      >>> out2 = model(fake_video)
      >>> print(out1.shape, out2.shape)
      torch.Size([1, 196, 768]) torch.Size([5, 196, 768])
code: def __init__(
      self,
      img_size=224,
      patch_size=16,
      in_chans=3,
      embed_dim=768,
      norm_layer=None,
      flatten=True,
  ):
      super().__init__()
      img_size = to_2tuple(img_size)
      patch_size = to_2tuple(patch_size)
      self.img_size = img_size
      self.patch_size = patch_size
      self.grid_size = (
          img_size[0] // patch_size[0],
          img_size[1] // patch_size[1],
      )
      self.num_patches = self.grid_size[0] * self.grid_size[1]
      self.flatten = flatten
  
      self.proj = Conv2d(
          in_chans, embed_dim, patch_size, patch_size
      )  # pylint: disable=too-many-function-args
      self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
  
imports: from torch import nn
  from towhee.models.utils.general_utils import to_2tuple
  from towhee.models.layers.layers_with_relprop import Conv2d
label_desc: Use image node_id 1 to create a new PatchEmbed2D object from inherited base classes: nn with example: obj = PatchEmbed2D(img_size, patch_size, in_chans, embed_dim, norm_layer, flatten)