code: def get_WPD_filter_with_rtf(
      psd_observed_bar: torch.Tensor,
      psd_speech: torch.Tensor,
      psd_noise: torch.Tensor,
      iterations: int = 3,
      reference_vector: Union[int, torch.Tensor] = 0,
      diagonal_loading: bool = True,
      diag_eps: float = 1e-7,
      eps: float = 1e-15,
  ) -> torch.Tensor:
      """Return the WPD vector calculated with RTF.
  
          WPD is the Weighted Power minimization Distortionless response
          convolutional beamformer. As follows:
  
          h = (Rf^-1 @ vbar) / (vbar^H @ R^-1 @ vbar)
  
      Reference:
          T. Nakatani and K. Kinoshita, "A Unified Convolutional Beamformer
          for Simultaneous Denoising and Dereverberation," in IEEE Signal
          Processing Letters, vol. 26, no. 6, pp. 903-907, June 2019, doi:
          10.1109/LSP.2019.2911179.
          https://ieeexplore.ieee.org/document/8691481
  
      Args:
          psd_observed_bar (torch.complex64):
              stacked observation covariance matrix
          psd_speech (torch.complex64):
              speech covariance matrix (..., F, C, C)
          psd_noise (torch.complex64):
              noise covariance matrix (..., F, C, C)
          iterations (int): number of iterations in power method
          reference_vector (torch.Tensor or int): (..., C) or scalar
          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): (..., F, C)
      """
      C = psd_noise.size(-1)
  
      # (B, F, C)
      rtf = get_rtf(
          psd_speech,
          psd_noise,
          mode="power",
          reference_vector=reference_vector,
          iterations=iterations,
          diagonal_loading=diagonal_loading,
          diag_eps=diag_eps,
      )
  
      # (B, F, (K+1)*C)
      rtf = torch.nn.functional.pad(
          rtf, (0, psd_observed_bar.shape[-1] - C), "constant", 0
      )
      # numerator: (..., C_1, C_2) x (..., C_2) -> (..., C_1)
      numerator = torch.linalg.solve(psd_observed_bar, rtf)
      denominator = torch.einsum(
          "...d,...d->...", rtf.conj(), numerator
      )
  
      if isinstance(reference_vector, int):
          scale = rtf[..., reference_vector, None].conj()
      else:
          scale = torch.einsum(
              "...c,...c->...",
              [
                  rtf[:, :, :C].conj(),
                  reference_vector[..., None, :].to(dtype=rtf.dtype),
              ],
          ).unsqueeze(-1)
      beamforming_vector = (
          numerator * scale / (denominator.real.unsqueeze(-1) + eps)
      )
      return beamforming_vector
  
imports: from typing import List, Union
  import torch
  import torch_complex.functional
  import torchaudio
label_desc: Use image node_id 19 for calling a global function with example usage: get_WPD_filter_with_rtf(psd_observed_bar, psd_speech, psd_noise, iterations, reference_vector, diagonal_loading, diag_eps, eps) and returns: beamforming_vector