code: def test_gevd(ch):
      stft = Stft(
          n_fft=8,
          win_length=None,
          hop_length=2,
          center=True,
          window="hann",
          normalized=False,
          onesided=True,
      )
      torch.random.manual_seed(0)
      x = random_speech[..., :ch]
      ilens = torch.LongTensor([16, 12])
      # (B, T, C, F) -> (B, F, C, T)
      X = torch.complex(
          *torch.unbind(stft(x, ilens)[0], dim=-1)
      ).transpose(-1, -3)
      # (B, F, C, C)
      Phi_X = torch.einsum("...ct,...et->...ce", [X, X.conj()])
  
      is_singular = True
      while is_singular:
          N = torch.randn_like(X)
          Phi_N = torch.einsum("...ct,...et->...ce", [N, N.conj()])
          is_singular = not torch.linalg.matrix_rank(Phi_N).eq(ch).all()
      # Phi_N = torch.eye(ch, dtype=Phi_X.dtype).view(1, 1, ch, ch).expand_as(Phi_X)
  
      # e_val: (B, F, C)
      # e_vec: (B, F, C, C)
      e_val, e_vec = generalized_eigenvalue_decomposition(Phi_X, Phi_N)
      e_val = e_val.to(dtype=e_vec.dtype)
      assert torch.allclose(
          torch.matmul(Phi_X, e_vec),
          torch.matmul(torch.matmul(Phi_N, e_vec), e_val.diag_embed()),
      )
  
file_path: espnet/test/espnet2/enh/layers/test_enh_layers.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.beamformer import generalized_eigenvalue_decomposition, get_rtf, gev_phase_correction, signal_framing
  from espnet2.enh.layers.complex_utils import solve
  from espnet2.layers.stft import Stft
label_desc: Use image node_id 3 for calling a global function with example usage: test_gevd(ch) without return types