code: def reshape_channel_to_batch_dim(x: Tensor) -> tuple[Tensor, int]:
      """
      Combines batch and channel dimensions.
  
      Args:
          x: input of shape (B,C,H,W,2) for 2D data or (B,C,H,W,D,2) for 3D data
  
      Returns:
          A tuple containing:
              (1) output of shape (B*C,1,...)
              (2) batch size
      """
  
      if len(x.shape) == 5:  # this is 2D
          b, c, h, w, two = x.shape
          return x.contiguous().view(b * c, 1, h, w, two), b
  
      elif len(x.shape) == 6:  # this is 3D
          b, c, h, w, d, two = x.shape
          return x.contiguous().view(b * c, 1, h, w, d, two), b
  
      else:
          raise ValueError(
              f"only 2D (B,C,H,W,2) and 3D (B,C,H,W,D,2) data are supported but x has shape {x.shape}"
          )
  
file_path: MONAI/monai/apps/reconstruction/networks/nets/utils.py
imports: from __future__ import annotations
  import math
  from torch import Tensor
  from torch.nn import functional
  from monai.apps.reconstruction.complex_utils import complex_conj_t, complex_mul_t
  from monai.networks.blocks.fft_utils_t import fftn_centered_t, ifftn_centered_t
label_desc: Use image node_id 3 for calling a global function with example usage: reshape_channel_to_batch_dim(x) and returns: x,  b, x,  b