class_docstr: 2D Image to Patch Embedding
class_docstr_tok: ["2D","Image","to","Patch","Embedding"]
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 = nn.Conv2d(
          in_chans, embed_dim, kernel_size=patch_size, stride=patch_size
      )
      self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
  
imports: import collections.abc
  import math
  import warnings
  from dataclasses import dataclass
  from functools import partial
  from itertools import repeat
  import omegaconf
  import torch
  import torch.nn
  import torch.nn.functional
  from mmf.common.registry import registry
  from mmf.modules.encoders import Encoder
label_desc: Use image node_id 1 to create a new PatchEmbed object from inherited base classes: nn with example: obj = PatchEmbed(img_size, patch_size, in_chans, embed_dim, norm_layer, flatten)