class_docstr: Computes the covariance matrices of the signals.
  
  Arguments:
  ----------
  average : bool
      Informs the module if it should return an average
      (computed on the time dimension) of the covariance
      matrices. The Default value is True.
  
  Example
  -------
  >>> import torch
  >>> from speechbrain.dataio.dataio import read_audio
  >>> from speechbrain.processing.features import STFT
  >>> from speechbrain.processing.multi_mic import Covariance
  >>>
  >>> xs_speech = read_audio(
  ...    'tests/samples/multi-mic/speech_-0.82918_0.55279_-0.082918.flac'
  ... )
  >>> xs_speech = xs_speech.unsqueeze(0) # [batch, time, channels]
  >>> xs_noise = read_audio('tests/samples/multi-mic/noise_diffuse.flac')
  >>> xs_noise = xs_noise.unsqueeze(0)
  >>> xs = xs_speech + 0.05 * xs_noise
  >>> fs = 16000
  
  >>> stft = STFT(sample_rate=fs)
  >>> cov = Covariance()
  >>>
  >>> Xs = stft(xs)
  >>> XXs = cov(Xs)
  >>> XXs.shape
  torch.Size([1, 1001, 201, 2, 10])
class_docstr_tok: ["Computes","the","covariance","matrices","of","the","signals",".","Arguments",":","--","--","--","--","--","average",":","bool","Informs","the","module","if","it","should","return","an","average","(","computed","on","the","time","dimension",")","of","the","covariance","matrices",".","The","Default","value","is","True",".","Example","--","--","--","-",">",">",">","import","torch",">",">",">","from","speechbrain.dataio.dataio","import","read_audio",">",">",">","from","speechbrain.processing.features","import","STFT",">",">",">","from","speechbrain.processing.multi_mic","import","Covariance",">",">",">",">",">",">","xs_speech","=","read_audio","(","...","'tests\/samples\/multi-mic\/speech_-0.82918_0.55279_-0.082918.flac'","...",")",">",">",">","xs_speech","=","xs_speech.unsqueeze","(","0",")","#","[","batch",",","time",",","channels","]",">",">",">","xs_noise","=","read_audio","(","'tests\/samples\/multi-mic\/noise_diffuse.flac","'",")",">",">",">","xs_noise","=","xs_noise.unsqueeze","(","0",")",">",">",">","xs","=","xs_speech","+","0.05","*","xs_noise",">",">",">","fs","=","16000",">",">",">","stft","=","STFT","(","sample_rate=fs",")",">",">",">","cov","=","Covariance","(",")",">",">",">",">",">",">","Xs","=","stft","(","xs",")",">",">",">","XXs","=","cov","(","Xs",")",">",">",">","XXs.shape","torch.Size","(","[","1",",","1001",",","201",",","2",",","10","]",")"]
docstr: Computes the covariance matrices (XXs) of the signals. The result will
  have the following format: (batch, time_step, n_fft/2 + 1, 2, n_mics + n_pairs).
  
  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)
  
  average : boolean
      Informs the function if it should return an average
      (computed on the time dimension) of the covariance
      matrices. Default value is True.
code: def _cov(Xs, average=True):
      """Computes the covariance matrices (XXs) of the signals. The result will
      have the following format: (batch, time_step, n_fft/2 + 1, 2, n_mics + n_pairs).
  
      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)
  
      average : boolean
          Informs the function if it should return an average
          (computed on the time dimension) of the covariance
          matrices. Default value is True.
      """
  
      # Get useful dimensions
      n_mics = Xs.shape[4]
  
      # Formatting the real and imaginary parts
      Xs_re = Xs[..., 0, :].unsqueeze(4)
      Xs_im = Xs[..., 1, :].unsqueeze(4)
  
      # Computing the covariance
      Rxx_re = torch.matmul(
          Xs_re, Xs_re.transpose(3, 4)
      ) + torch.matmul(Xs_im, Xs_im.transpose(3, 4))
  
      Rxx_im = torch.matmul(
          Xs_re, Xs_im.transpose(3, 4)
      ) - torch.matmul(Xs_im, Xs_re.transpose(3, 4))
  
      # Selecting the upper triangular part of the covariance matrices
      idx = torch.triu_indices(n_mics, n_mics)
  
      XXs_re = Rxx_re[..., idx[0], idx[1]]
      XXs_im = Rxx_im[..., idx[0], idx[1]]
  
      XXs = torch.stack((XXs_re, XXs_im), 3)
  
      # Computing the average if desired
      if average is True:
          n_time_frames = XXs.shape[1]
          XXs = torch.mean(XXs, 1, keepdim=True)
          XXs = XXs.repeat(1, n_time_frames, 1, 1, 1)
  
      return XXs
  
imports: import torch
  from packaging import version
  import speechbrain.processing.decomposition
label_desc: Use image node_id 3 for calling the Covariance obj's underlying member method code with example usage: obj._cov(Xs, average) and returns: XXs