class_docstr: 2D Image to Patch Embedding
      
class_docstr_tok: ["2D","Image","to","Patch","Embedding"]
code: def __init__(
      self,
      img_size: Optional[int] = 224,
      patch_size: int = 16,
      in_chans: int = 3,
      embed_dim: int = 768,
      norm_layer: Optional[Callable] = None,
      flatten: bool = True,
      output_fmt: Optional[str] = None,
      bias: bool = True,
      strict_img_size: bool = True,
      dynamic_img_pad: bool = False,
  ):
      super().__init__()
      self.patch_size = to_2tuple(patch_size)
      if img_size is not None:
          self.img_size = to_2tuple(img_size)
          self.grid_size = tuple(
              [s // p for s, p in zip(self.img_size, self.patch_size)]
          )
          self.num_patches = self.grid_size[0] * self.grid_size[1]
      else:
          self.img_size = None
          self.grid_size = None
          self.num_patches = None
  
      if output_fmt is not None:
          self.flatten = False
          self.output_fmt = Format(output_fmt)
      else:
          # flatten spatial dim and transpose to channels last, kept for bwd compat
          self.flatten = flatten
          self.output_fmt = Format.NCHW
      self.strict_img_size = strict_img_size
      self.dynamic_img_pad = dynamic_img_pad
  
      self.proj = nn.Conv2d(
          in_chans,
          embed_dim,
          kernel_size=patch_size,
          stride=patch_size,
          bias=bias,
      )
      self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
  
file_path: pytorch-image-models/timm/layers/patch_embed.py
imports: import logging
  from typing import Callable, List, Optional, Tuple, Union
  import torch
  from torch import nn
  import torch.nn.functional
  from .format import Format, nchw_to
  from .helpers import to_2tuple
  from .trace_utils import _assert
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, output_fmt, bias, strict_img_size, dynamic_img_pad)