class_docstr: Patch Embedding Layer constructed of two 2D convolutional layers.
  
  Input: tensor of shape `[batch_size, in_channels, height, width]`
  
  Output: tensor of shape `[batch_size, out_channels, height/4, width/4]`
class_docstr_tok: ["Patch","Embedding","Layer","constructed","of","two","2D","convolutional","layers",".","Input",":","tensor","of","shape","`","[","batch_size",",","in_channels",",","height",",","width","]","`","Output",":","tensor","of","shape","`","[","batch_size",",","out_channels",",","height\/4",",","width\/4","]","`"]
code: def __init__(self, config: SwiftFormerConfig):
      super().__init__()
  
      in_chs = config.num_channels
      out_chs = config.embed_dims[0]
      self.patch_embedding = nn.Sequential(
          nn.Conv2d(
              in_chs, out_chs // 2, kernel_size=3, stride=2, padding=1
          ),
          nn.BatchNorm2d(out_chs // 2, eps=config.batch_norm_eps),
          nn.ReLU(),
          nn.Conv2d(
              out_chs // 2, out_chs, kernel_size=3, stride=2, padding=1
          ),
          nn.BatchNorm2d(out_chs, eps=config.batch_norm_eps),
          nn.ReLU(),
      )
  
imports: import collections.abc
  from typing import Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2CLS
  from ...modeling_outputs import BaseModelOutputWithNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging
  from .configuration_swiftformer import SwiftFormerConfig
label_desc: Use image node_id 1 to create a new SwiftFormerPatchEmbedding object from inherited base classes: nn with example: obj = SwiftFormerPatchEmbedding(config)