code: def convert_to_tensor_complex(
      data: NdarrayOrTensor | list | int | float,
      dtype: torch.dtype | None = None,
      device: torch.device | None = None,
      wrap_sequence: bool = True,
      track_meta: bool = False,
  ) -> Tensor:
      """
      Convert complex-valued data to a 2-channel PyTorch tensor.
      The real and imaginary parts are stacked along the last dimension.
      This function relies on 'monai.utils.type_conversion.convert_to_tensor'
  
      Args:
          data: input data can be PyTorch Tensor, numpy array, list, int, and float.
              will convert Tensor, Numpy array, float, int, bool to Tensor, strings and objects keep the original.
              for list, convert every item to a Tensor if applicable.
          dtype: target data type to when converting to Tensor.
          device: target device to put the converted Tensor data.
          wrap_sequence: if `False`, then lists will recursively call this function.
              E.g., `[1, 2]` -> `[tensor(1), tensor(2)]`. If `True`, then `[1, 2]` -> `tensor([1, 2])`.
          track_meta: whether to track the meta information, if `True`, will convert to `MetaTensor`.
              default to `False`.
  
      Returns:
          PyTorch version of the data
  
      Example:
          .. code-block:: python
  
              import numpy as np
              data = np.array([ [1+1j, 1-1j], [2+2j, 2-2j] ])
              # the following line prints (2,2)
              print(data.shape)
              # the following line prints torch.Size([2, 2, 2])
              print(convert_to_tensor_complex(data).shape)
      """
      # if data is not complex, just turn it into a tensor
      if isinstance(data, Tensor):
          if not torch.is_complex(data):
              converted_data: Tensor = convert_to_tensor(
                  data,
                  dtype=dtype,
                  device=device,
                  wrap_sequence=wrap_sequence,
                  track_meta=track_meta,
              )
              return converted_data
      else:
          if not np.iscomplexobj(data):
              converted_data = convert_to_tensor(
                  data,
                  dtype=dtype,
                  device=device,
                  wrap_sequence=wrap_sequence,
                  track_meta=track_meta,
              )
              return converted_data
  
      # if data is complex, turn its stacked version into a tensor
      if isinstance(data, torch.Tensor):
          data = torch.stack([data.real, data.imag], dim=-1)
  
      elif isinstance(data, np.ndarray):
          if re.search(r"[SaUO]", data.dtype.str) is None:
              # numpy array with 0 dims is also sequence iterable,
              # `ascontiguousarray` will add 1 dim if img has no dim, so we only apply on data with dims
              if data.ndim > 0:
                  data = np.ascontiguousarray(data)
              data = np.stack((data.real, data.imag), axis=-1)
  
      elif isinstance(data, (float, int)):
          data = [[data.real, data.imag]]
  
      elif isinstance(data, list):
          data = convert_to_numpy(data, wrap_sequence=True)
          data = np.stack((data.real, data.imag), axis=-1).tolist()  # type: ignore
  
      converted_data = convert_to_tensor(
          data,
          dtype=dtype,
          device=device,
          wrap_sequence=wrap_sequence,
          track_meta=track_meta,
      )
      return converted_data
  
file_path: MONAI/monai/apps/reconstruction/complex_utils.py
imports: from __future__ import annotations
  import re
  import numpy
  import torch
  from torch import Tensor
  from monai.config.type_definitions import NdarrayOrTensor
  from monai.utils.type_conversion import convert_to_numpy, convert_to_tensor
label_desc: Use image node_id 1 for calling a global function with example usage: convert_to_tensor_complex(data, dtype, device, wrap_sequence, track_meta) and returns: converted_data, converted_data, converted_data