class_docstr: Patch Merging Layer.
  Args:
      dim (int): Number of input channels.
      norm_layer (nn.Module): Normalization layer. Default: nn.LayerNorm.
class_docstr_tok: ["Patch","Merging","Layer",".","Args",":","dim","(","int",")",":","Number","of","input","channels",".","norm_layer","(","nn.Module",")",":","Normalization","layer",".","Default",":","nn.LayerNorm","."]
docstr: Args:
      x (Tensor): input tensor with expected layout of [..., H, W, C]
  Returns:
      Tensor with layout of [..., H/2, W/2, 2*C]
docstr_tok: ["Args",":","x","(","Tensor",")",":","input","tensor","with","expected","layout","of","[","...",",","H",",","W",",","C","]","Returns",":","Tensor","with","layout","of","[","...",",","H\/2",",","W\/2",",","2","*","C","]"]
code: def forward(self, x: Tensor):
      """
      Args:
          x (Tensor): input tensor with expected layout of [..., H, W, C]
      Returns:
          Tensor with layout of [..., H/2, W/2, 2*C]
      """
      x = _patch_merging_pad(x)
      x = self.norm(x)
      x = self.reduction(x)  # ... H/2 W/2 2*C
      return x
  
imports: import math
  from functools import partial
  from typing import Any, Callable, List, Optional
  import torch
  import torch.nn.functional
  from torch import nn, Tensor
  from ..ops.misc import MLP, Permute
  from ..ops.stochastic_depth import StochasticDepth
  from ..transforms._presets import ImageClassification, InterpolationMode
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 2 for calling the PatchMerging obj's underlying member method code with example usage: obj.forward(x) and returns: x