class_docstr: The `PatchMerging` module previously defined in v0.9.0.
code: def forward(self, x):
      x_shape = x.size()
      if len(x_shape) == 4:
          return super().forward(x)
      if len(x_shape) != 5:
          raise ValueError(f"expecting 5D x, got {x.shape}.")
      b, d, h, w, c = x_shape
      pad_input = (h % 2 == 1) or (w % 2 == 1) or (d % 2 == 1)
      if pad_input:
          x = F.pad(x, (0, 0, 0, w % 2, 0, h % 2, 0, d % 2))
      x0 = x[:, 0::2, 0::2, 0::2, :]
      x1 = x[:, 1::2, 0::2, 0::2, :]
      x2 = x[:, 0::2, 1::2, 0::2, :]
      x3 = x[:, 0::2, 0::2, 1::2, :]
      x4 = x[:, 1::2, 0::2, 1::2, :]
      x5 = x[:, 0::2, 1::2, 0::2, :]
      x6 = x[:, 0::2, 0::2, 1::2, :]
      x7 = x[:, 1::2, 1::2, 1::2, :]
      x = torch.cat([x0, x1, x2, x3, x4, x5, x6, x7], -1)
      x = self.norm(x)
      x = self.reduction(x)
      return x
  
imports: from __future__ import annotations
  import itertools
  from collections.abc import Sequence
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from torch.nn import LayerNorm
  from typing_extensions import Final
  from monai.networks.blocks import MLPBlock
  from monai.networks.blocks import PatchEmbed, UnetOutBlock, UnetrBasicBlock, UnetrUpBlock
  from monai.networks.layers import DropPath, trunc_normal_
  from monai.utils import ensure_tuple_rep, look_up_option, optional_import
  from monai.utils.deprecate_utils import deprecated_arg
label_desc: Use image node_id 1 for calling the PatchMerging obj's underlying member method code with example usage: obj.forward(x) and returns: x, super