code: def complex_normalize(x: Tensor) -> tuple[Tensor, Tensor, Tensor]:
      """
      Performs layer mean-std normalization for complex data. Normalization is done for each batch member
      along each part (part refers to real and imaginary parts), separately.
  
      Args:
          x: input of shape (B,C,H,W) for 2D data or (B,C,H,W,D) for 3D data
  
      Returns:
          A tuple containing
              (1) normalized output of shape (B,C,H,W) for 2D data or (B,C,H,W,D) for 3D data
              (2) mean
              (3) std
      """
      if len(x.shape) == 4:  # this is 2D
          b, c, h, w = x.shape
          x = x.contiguous().view(b, 2, c // 2 * h * w)
          mean = (
              x.mean(dim=2)
              .view(b, 2, 1, 1, 1)
              .expand(b, 2, c // 2, 1, 1)
              .contiguous()
              .view(b, c, 1, 1)
          )
          std = (
              x.std(dim=2, unbiased=False)
              .view(b, 2, 1, 1, 1)
              .expand(b, 2, c // 2, 1, 1)
              .contiguous()
              .view(b, c, 1, 1)
          )
          x = x.view(b, c, h, w)
          return (x - mean) / std, mean, std
  
      elif len(x.shape) == 5:  # this is 3D
          b, c, h, w, d = x.shape
          x = x.contiguous().view(b, 2, c // 2 * h * w * d)
          mean = (
              x.mean(dim=2)
              .view(b, 2, 1, 1, 1, 1)
              .expand(b, 2, c // 2, 1, 1, 1)
              .contiguous()
              .view(b, c, 1, 1, 1)
          )
          std = (
              x.std(dim=2, unbiased=False)
              .view(b, 2, 1, 1, 1, 1)
              .expand(b, 2, c // 2, 1, 1, 1)
              .contiguous()
              .view(b, c, 1, 1, 1)
          )
          x = x.view(b, c, h, w, d)
          return (x - mean) / std, mean, std
  
      else:
          raise ValueError(
              f"only 2D (B,C,H,W) and 3D (B,C,H,W,D) 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 5 for calling a global function with example usage: complex_normalize(x) and returns: unknown,  mean,  std, unknown,  mean,  std