class_docstr: Perform minimum variance distortionless response (MVDR) beamforming
  by using an input signal in the frequency domain, its covariance matrices
  and tdoas (to compute a steering vector).
  
      Example
      -------
      >>> import torch
  
      >>> from speechbrain.dataio.dataio import read_audio
      >>> from speechbrain.processing.features import STFT, ISTFT
      >>> from speechbrain.processing.multi_mic import Covariance
      >>> from speechbrain.processing.multi_mic import GccPhat, DelaySum
      >>>
      >>> xs_speech = read_audio(
      ...    'tests/samples/multi-mic/speech_-0.82918_0.55279_-0.082918.flac'
      ... )
      >>> xs_speech = xs_speech.unsqueeze(0) # [batch, time, channel]
      >>> xs_noise  = read_audio('tests/samples/multi-mic/noise_diffuse.flac')
      >>> xs_noise = xs_noise.unsqueeze(0) #[batch, time, channels]
      >>> fs = 16000
      >>> xs = xs_speech + 0.05 * xs_noise
      >>>
      >>> stft = STFT(sample_rate=fs)
      >>> cov = Covariance()
      >>> gccphat = GccPhat()
      >>> mvdr = Mvdr()
      >>> istft = ISTFT(sample_rate=fs)
      >>>
      >>> Xs = stft(xs)
      >>> Ns = stft(xs_noise)
      >>> XXs = cov(Xs)
      >>> NNs = cov(Ns)
      >>> tdoas = gccphat(XXs)
      >>> Ys = mvdr(Xs, NNs, tdoas)
      >>> ys = istft(Ys)
class_docstr_tok: ["Perform","minimum","variance","distortionless","response","(","MVDR",")","beamforming","by","using","an","input","signal","in","the","frequency","domain",",","its","covariance","matrices","and","tdoas","(","to","compute","a","steering","vector",")",".","Example","--","--","--","-",">",">",">","import","torch",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","from","speechbrain.processing.features","import","STFT",",","ISTFT",">",">",">","from","speechbrain.processing.multi_mic","import","Covariance",">",">",">","from","speechbrain.processing.multi_mic","import","GccPhat",",","DelaySum",">",">",">",">",">",">","xs_speech","=","read_audio","(","...","'tests\/samples\/multi-mic\/speech_-0.82918_0.55279_-0.082918.flac'","...",")",">",">",">","xs_speech","=","xs_speech.unsqueeze","(","0",")","#","[","batch",",","time",",","channel","]",">",">",">","xs_noise","=","read_audio","(","'tests\/samples\/multi-mic\/noise_diffuse.flac","'",")",">",">",">","xs_noise","=","xs_noise.unsqueeze","(","0",")","#","[","batch",",","time",",","channels","]",">",">",">","fs","=","16000",">",">",">","xs","=","xs_speech","+","0.05","*","xs_noise",">",">",">",">",">",">","stft","=","STFT","(","sample_rate=fs",")",">",">",">","cov","=","Covariance","(",")",">",">",">","gccphat","=","GccPhat","(",")",">",">",">","mvdr","=","Mvdr","(",")",">",">",">","istft","=","ISTFT","(","sample_rate=fs",")",">",">",">",">",">",">","Xs","=","stft","(","xs",")",">",">",">","Ns","=","stft","(","xs_noise",")",">",">",">","XXs","=","cov","(","Xs",")",">",">",">","NNs","=","cov","(","Ns",")",">",">",">","tdoas","=","gccphat","(","XXs",")",">",">",">","Ys","=","mvdr","(","Xs",",","NNs",",","tdoas",")",">",">",">","ys","=","istft","(","Ys",")"]
docstr: Perform minimum variance distortionless response beamforming.
  
  Arguments
  ---------
  Xs : tensor
      A batch of audio signals in the frequency domain.
      The tensor must have the following format:
      (batch, time_step, n_fft/2 + 1, 2, n_mics).
  NNs : tensor
      The covariance matrices of the noise signal. The tensor must
      have the format (batch, time_steps, n_fft/2 + 1, 2, n_mics + n_pairs).
  As : tensor
      The steering vector to point in the direction of
      the target source. The tensor must have the format
      (batch, time_step, n_fft/2 + 1, 2, n_mics).
code: def _mvdr(Xs, NNs, As, eps=1e-20):
      """Perform minimum variance distortionless response beamforming.
  
      Arguments
      ---------
      Xs : tensor
          A batch of audio signals in the frequency domain.
          The tensor must have the following format:
          (batch, time_step, n_fft/2 + 1, 2, n_mics).
      NNs : tensor
          The covariance matrices of the noise signal. The tensor must
          have the format (batch, time_steps, n_fft/2 + 1, 2, n_mics + n_pairs).
      As : tensor
          The steering vector to point in the direction of
          the target source. The tensor must have the format
          (batch, time_step, n_fft/2 + 1, 2, n_mics).
      """
  
      # Get unique covariance values to reduce the number of computations
      NNs_val, NNs_idx = torch.unique(NNs, return_inverse=True, dim=1)
  
      # Inverse covariance matrices
      NNs_inv = eig.inv(NNs_val)
  
      # Capture real and imaginary parts, and restore time steps
      NNs_inv_re = NNs_inv[..., 0][:, NNs_idx]
      NNs_inv_im = NNs_inv[..., 1][:, NNs_idx]
  
      # Decompose steering vector
      AsC_re = As[..., 0, :].unsqueeze(4)
      AsC_im = 1.0 * As[..., 1, :].unsqueeze(4)
      AsT_re = AsC_re.transpose(3, 4)
      AsT_im = -1.0 * AsC_im.transpose(3, 4)
  
      # Project
      NNs_inv_AsC_re = torch.matmul(NNs_inv_re, AsC_re) - torch.matmul(
          NNs_inv_im, AsC_im
      )
      NNs_inv_AsC_im = torch.matmul(NNs_inv_re, AsC_im) + torch.matmul(
          NNs_inv_im, AsC_re
      )
  
      # Compute the gain
      alpha = 1.0 / (
          torch.matmul(AsT_re, NNs_inv_AsC_re)
          - torch.matmul(AsT_im, NNs_inv_AsC_im)
      )
  
      # Get the unmixing coefficients
      Ws_re = torch.matmul(NNs_inv_AsC_re, alpha).squeeze(4)
      Ws_im = -torch.matmul(NNs_inv_AsC_im, alpha).squeeze(4)
  
      # Applying MVDR
      Xs_re = Xs[..., 0, :]
      Xs_im = Xs[..., 1, :]
  
      Ys_re = torch.sum(
          (Ws_re * Xs_re - Ws_im * Xs_im), dim=3, keepdim=True
      )
      Ys_im = torch.sum(
          (Ws_re * Xs_im + Ws_im * Xs_re), dim=3, keepdim=True
      )
  
      Ys = torch.stack((Ys_re, Ys_im), -2)
  
      return Ys
  
imports: import torch
  from packaging import version
  import speechbrain.processing.decomposition
label_desc: Use image node_id 3 for calling the Mvdr obj's underlying member method code with example usage: obj._mvdr(Xs, NNs, As, eps) and returns: Ys