code: def test_complex_impl_consistency():
      if not is_torch_1_9_plus:
          return
      torch.random.manual_seed(0)
      mat_th = torch.complex(
          torch.from_numpy(mat_np.real), torch.from_numpy(mat_np.imag)
      )
      mat_ct = ComplexTensor(
          torch.from_numpy(mat_np.real), torch.from_numpy(mat_np.imag)
      )
      bs = mat_th.shape[0]
      rank = mat_th.shape[-1]
      vec_th = torch.complex(
          torch.rand(bs, rank), torch.rand(bs, rank)
      ).type_as(mat_th)
      vec_ct = ComplexTensor(vec_th.real, vec_th.imag)
  
      for result_th, result_ct in (
          (abs(mat_th), abs(mat_ct)),
          (inverse(mat_th), inverse(mat_ct)),
          (
              matmul(mat_th, vec_th.unsqueeze(-1)),
              matmul(mat_ct, vec_ct.unsqueeze(-1)),
          ),
          (
              solve(vec_th.unsqueeze(-1), mat_th),
              solve(vec_ct.unsqueeze(-1), mat_ct),
          ),
          (
              einsum("bec,bc->be", mat_th, vec_th),
              einsum("bec,bc->be", mat_ct, vec_ct),
          ),
      ):
          np.testing.assert_allclose(
              result_th.numpy(), result_ct.numpy(), atol=1e-6
          )
  
file_path: espnet/test/espnet2/enh/layers/test_complex_utils.py
imports: import numpy
  import pytest
  import torch
  import torch_complex.functional
  from packaging.version import parse
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.layers.complex_utils import cat, complex_norm, einsum, inverse, matmul, solve, stack, trace
label_desc: Use image node_id 9 for calling a global function with example usage: test_complex_impl_consistency() without return types