code: def einsum(equation, *operands):
      # NOTE: Do not mix ComplexTensor and torch.complex in the input!
      # NOTE (wangyou): Until PyTorch 1.9.0, torch.einsum does not support
      # mixed input with complex and real tensors.
      if len(operands) == 1:
          if isinstance(operands[0], (tuple, list)):
              operands = operands[0]
          complex_module = (
              FC if isinstance(operands[0], ComplexTensor) else torch
          )
          return complex_module.einsum(equation, *operands)
      elif len(operands) != 2:
          op0 = operands[0]
          same_type = all(op.dtype == op0.dtype for op in operands[1:])
          if same_type:
              _einsum = (
                  FC.einsum
                  if isinstance(op0, ComplexTensor)
                  else torch.einsum
              )
              return _einsum(equation, *operands)
          else:
              raise ValueError(
                  "0 or More than 2 operands are not supported."
              )
      a, b = operands
      if isinstance(a, ComplexTensor) or isinstance(b, ComplexTensor):
          return FC.einsum(equation, a, b)
      elif torch.is_complex(a) or torch.is_complex(b):
          if not torch.is_complex(a):
              o_real = torch.einsum(equation, a, b.real)
              o_imag = torch.einsum(equation, a, b.imag)
              return torch.complex(o_real, o_imag)
          elif not torch.is_complex(b):
              o_real = torch.einsum(equation, a.real, b)
              o_imag = torch.einsum(equation, a.imag, b)
              return torch.complex(o_real, o_imag)
          else:
              return torch.einsum(equation, a, b)
      else:
          return torch.einsum(equation, a, b)
  
file_path: espnet/espnet2/enh/layers/complex_utils.py
imports: from typing import Sequence, Tuple, Union
  import torch
  from torch_complex import functional
  from torch_complex.tensor import ComplexTensor
label_desc: Use image node_id 9 for calling a global function with example usage: einsum(equation) and returns: complex_module, FC, torch, _einsum, torch, torch, torch