class_docstr: 2D Image to Patch Embedding
      
class_docstr_tok: ["2D","Image","to","Patch","Embedding"]
code: def forward(self, x) -> Tuple[torch.Tensor, List[int]]:
      B, C, H, W = x.shape
      if self.img_size is not None:
          _assert(
              H % self.patch_size[0] == 0,
              f"Input image height ({H}) must be divisible by patch size ({self.patch_size[0]}).",
          )
          _assert(
              W % self.patch_size[1] == 0,
              f"Input image width ({W}) must be divisible by patch size ({self.patch_size[1]}).",
          )
  
      x = self.proj(x)
      grid_size = x.shape[-2:]
      if self.flatten:
          x = x.flatten(2).transpose(1, 2)  # NCHW -> NLC
      elif self.output_fmt != Format.NCHW:
          x = nchw_to(x, self.output_fmt)
      x = self.norm(x)
      return x, grid_size
  
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 2 for calling the PatchEmbedWithSize obj's underlying member method code with example usage: obj.forward(x) and returns: x,  grid_size