code: def get_mvdr_vector(
      psd_s,
      psd_n,
      reference_vector: torch.Tensor,
      diagonal_loading: bool = True,
      diag_eps: float = 1e-7,
      eps: float = 1e-8,
  ):
      """Return the MVDR (Minimum Variance Distortionless Response) vector:
  
          h = (Npsd^-1 @ Spsd) / (Tr(Npsd^-1 @ Spsd)) @ u
  
      Reference:
          On optimal frequency-domain multichannel linear filtering
          for noise reduction; M. Souden et al., 2010;
          https://ieeexplore.ieee.org/document/5089420
  
      Args:
          psd_s (torch.complex64/ComplexTensor):
              speech covariance matrix (..., F, C, C)
          psd_n (torch.complex64/ComplexTensor):
              observation/noise covariance matrix (..., F, C, C)
          reference_vector (torch.Tensor): (..., C)
          diagonal_loading (bool): Whether to add a tiny term to the diagonal of psd_n
          diag_eps (float):
          eps (float):
      Returns:
          beamform_vector (torch.complex64/ComplexTensor): (..., F, C)
      """  # noqa: D400
      if diagonal_loading:
          psd_n = tik_reg(psd_n, reg=diag_eps, eps=eps)
  
      numerator = solve(psd_s, psd_n)
      # NOTE (wangyou): until PyTorch 1.9.0, torch.trace does not
      # support bacth processing. Use FC.trace() as fallback.
      # ws: (..., C, C) / (...,) -> (..., C, C)
      ws = numerator / (FC.trace(numerator)[..., None, None] + eps)
      # h: (..., F, C_1, C_2) x (..., C_2) -> (..., F, C_1)
      beamform_vector = einsum(
          "...fec,...c->...fe", ws, reference_vector
      )
      return beamform_vector
  
imports: from typing import List, Union
  import torch
  from packaging.version import parse
  from torch_complex import functional
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.layers.complex_utils import cat, complex_norm, einsum, inverse, is_complex, is_torch_complex_tensor, matmul, reverse, solve, to_double
label_desc: Use image node_id 4 for calling a global function with example usage: get_mvdr_vector(psd_s, psd_n, reference_vector, diagonal_loading, diag_eps, eps) and returns: beamform_vector