class_docstr: Patch embedding block based on: "Liu et al.,
  Swin Transformer: Hierarchical Vision Transformer using Shifted Windows
  <https://arxiv.org/abs/2103.14030>"
  https://github.com/microsoft/Swin-Transformer
  
  Unlike ViT patch embedding block: (1) input is padded to satisfy window size requirements (2) normalized if
  specified (3) position embedding is not used.
  
  Example::
  
      >>> from monai.networks.blocks import PatchEmbed
      >>> PatchEmbed(patch_size=2, in_chans=1, embed_dim=48, norm_layer=nn.LayerNorm, spatial_dims=3)
class_docstr_tok: ["Patch","embedding","block","based","on",":","``","Liu","et","al.",",","Swin","Transformer",":","Hierarchical","Vision","Transformer","using","Shifted","Windows","<","https",":","\/\/arxiv.org\/abs\/2103.14030",">","''","https",":","\/\/github.com\/microsoft\/Swin-Transformer","Unlike","ViT","patch","embedding","block",":","(","1",")","input","is","padded","to","satisfy","window","size","requirements","(","2",")","normalized","if","specified","(","3",")","position","embedding","is","not","used",".","Example",":",":",">",">",">","from","monai.networks.blocks","import","PatchEmbed",">",">",">","PatchEmbed","(","patch_size=2",",","in_chans=1",",","embed_dim=48",",","norm_layer=nn.LayerNorm",",","spatial_dims=3",")"]
docstr: Args:
      patch_size: dimension of patch size.
      in_chans: dimension of input channels.
      embed_dim: number of linear projection output channels.
      norm_layer: normalization layer.
      spatial_dims: spatial dimension.
docstr_tok: ["Args",":","patch_size",":","dimension","of","patch","size",".","in_chans",":","dimension","of","input","channels",".","embed_dim",":","number","of","linear","projection","output","channels",".","norm_layer",":","normalization","layer",".","spatial_dims",":","spatial","dimension","."]
code: def __init__(
      self,
      patch_size: Sequence[int] | int = 2,
      in_chans: int = 1,
      embed_dim: int = 48,
      norm_layer: type[LayerNorm] = nn.LayerNorm,
      spatial_dims: int = 3,
  ) -> None:
      """
      Args:
          patch_size: dimension of patch size.
          in_chans: dimension of input channels.
          embed_dim: number of linear projection output channels.
          norm_layer: normalization layer.
          spatial_dims: spatial dimension.
      """
  
      super().__init__()
  
      if spatial_dims not in (2, 3):
          raise ValueError("spatial dimension should be 2 or 3.")
  
      patch_size = ensure_tuple_rep(patch_size, spatial_dims)
      self.patch_size = patch_size
      self.embed_dim = embed_dim
      self.proj = Conv[Conv.CONV, spatial_dims](
          in_channels=in_chans,
          out_channels=embed_dim,
          kernel_size=patch_size,
          stride=patch_size,
      )
      if norm_layer is not None:
          self.norm = norm_layer(embed_dim)
      else:
          self.norm = None
  
imports: from __future__ import annotations
  from collections.abc import Sequence
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import LayerNorm
  from monai.networks.blocks.pos_embed_utils import build_sincos_position_embedding
  from monai.networks.layers import Conv, trunc_normal_
  from monai.utils import deprecated_arg, ensure_tuple_rep, optional_import
  from monai.utils.module import look_up_option
label_desc: Use image node_id 1 to create a new PatchEmbed object from inherited base classes: nn with example: obj = PatchEmbed(patch_size, in_chans, embed_dim, norm_layer, spatial_dims)