class_docstr: iNeuBe, iterative neural/beamforming enhancement
  
  Reference:
  Lu, Y. J., Cornell, S., Chang, X., Zhang, W., Li, C., Ni, Z., ... & Watanabe, S.
  Towards Low-Distortion Multi-Channel Speech Enhancement:
  The ESPNET-Se Submission to the L3DAS22 Challenge. ICASSP 2022 p. 9201-9205.
  
  NOTES:
  As outlined in the Reference, this model works best when coupled with
  the MultiResL1SpecLoss defined in criterions/time_domain.py.
  The model is trained with variance normalized mixture input and target.
  e.g. with mixture of shape [batch, microphones, samples] you normalize
  it by dividing with torch.std(mixture, (1, 2)). You must do the same
  for the target signal.
  In the Reference, the variance normalization was performed offline
  (we normalized by the std computed on the entire training set and not
  for each input separately). However we found out that also normalizing
  each input and target separately works well.
  
  
  Args:
      n_spk: number of output sources/speakers.
      n_fft: stft window size.
      stride: stft stride.
      window: stft window type choose between 'hamming', 'hanning' or None.
      mic_channels: number of microphones channels
          (only fixed-array geometry supported).
      hid_chans: number of channels in the subsampling/upsampling conv layers.
      hid_chans_dense: number of channels in the densenet layers
          (reduce this to reduce VRAM requirements).
      ksz_dense: kernel size in the densenet layers thorough iNeuBe.
      ksz_tcn: kernel size in the TCN submodule.
      tcn_repeats: number of repetitions of blocks in the TCN submodule.
      tcn_blocks: number of blocks in the TCN submodule.
      tcn_channels: number of channels in the TCN submodule.
      activation: activation function to use in the whole iNeuBe model,
          you can use any torch supported activation e.g. 'relu' or 'elu'.
      output_from: output the estimate from 'dnn1', 'mfmcwf' or 'dnn2'.
      n_chunks: number of future and past frames to consider for mfMCWF computation.
      freeze_dnn1: whether or not freezing dnn1 parameters during training of dnn2.
      tik_eps: diagonal loading in the mfMCWF computation.
class_docstr_tok: ["iNeuBe",",","iterative","neural\/beamforming","enhancement","Reference",":","Lu",",","Y.","J.",",","Cornell",",","S.",",","Chang",",","X.",",","Zhang",",","W.",",","Li",",","C.",",","Ni",",","Z.",",","...","&","Watanabe",",","S.","Towards","Low-Distortion","Multi-Channel","Speech","Enhancement",":","The","ESPNET-Se","Submission","to","the","L3DAS22","Challenge",".","ICASSP","2022","p.","9201-9205",".","NOTES",":","As","outlined","in","the","Reference",",","this","model","works","best","when","coupled","with","the","MultiResL1SpecLoss","defined","in","criterions\/time_domain.py",".","The","model","is","trained","with","variance","normalized","mixture","input","and","target",".","e.g",".","with","mixture","of","shape","[","batch",",","microphones",",","samples","]","you","normalize","it","by","dividing","with","torch.std","(","mixture",",","(","1",",","2",")",")",".","You","must","do","the","same","for","the","target","signal",".","In","the","Reference",",","the","variance","normalization","was","performed","offline","(","we","normalized","by","the","std","computed","on","the","entire","training","set","and","not","for","each","input","separately",")",".","However","we","found","out","that","also","normalizing","each","input","and","target","separately","works","well",".","Args",":","n_spk",":","number","of","output","sources\/speakers",".","n_fft",":","stft","window","size",".","stride",":","stft","stride",".","window",":","stft","window","type","choose","between","'hamming","'",",","'hanning","'","or","None",".","mic_channels",":","number","of","microphones","channels","(","only","fixed-array","geometry","supported",")",".","hid_chans",":","number","of","channels","in","the","subsampling\/upsampling","conv","layers",".","hid_chans_dense",":","number","of","channels","in","the","densenet","layers","(","reduce","this","to","reduce","VRAM","requirements",")",".","ksz_dense",":","kernel","size","in","the","densenet","layers","thorough","iNeuBe",".","ksz_tcn",":","kernel","size","in","the","TCN","submodule",".","tcn_repeats",":","number","of","repetitions","of","blocks","in","the","TCN","submodule",".","tcn_blocks",":","number","of","blocks","in","the","TCN","submodule",".","tcn_channels",":","number","of","channels","in","the","TCN","submodule",".","activation",":","activation","function","to","use","in","the","whole","iNeuBe","model",",","you","can","use","any","torch","supported","activation","e.g",".","'relu","'","or","'elu","'",".","output_from",":","output","the","estimate","from","'dnn1","'",",","'mfmcwf","'","or","'dnn2","'",".","n_chunks",":","number","of","future","and","past","frames","to","consider","for","mfMCWF","computation",".","freeze_dnn1",":","whether","or","not","freezing","dnn1","parameters","during","training","of","dnn2",".","tik_eps",":","diagonal","loading","in","the","mfMCWF","computation","."]
docstr: multi-frame multi-channel wiener filter.
  
  Args:
      mixture (torch.Tensor): multi-channel STFT complex mixture tensor,
          of shape [B, T, C, F] batch, frames, microphones, frequencies.
      estimate (torch.Tensor): monaural STFT complex estimate
          of target source [B, T, F] batch, frames, frequencies.
      n_chunks (int): number of past and future mfMCWF frames.
          If 0 then standard MCWF.
      tik_eps (float): diagonal loading for matrix inversion in MCWF computation.
  
  Returns:
      beamformed (torch.Tensor): monaural STFT complex estimate
          of target source after MFMCWF [B, T, F] batch, frames, frequencies.
docstr_tok: ["multi-frame","multi-channel","wiener","filter",".","Args",":","mixture","(","torch.Tensor",")",":","multi-channel","STFT","complex","mixture","tensor",",","of","shape","[","B",",","T",",","C",",","F","]","batch",",","frames",",","microphones",",","frequencies",".","estimate","(","torch.Tensor",")",":","monaural","STFT","complex","estimate","of","target","source","[","B",",","T",",","F","]","batch",",","frames",",","frequencies",".","n_chunks","(","int",")",":","number","of","past","and","future","mfMCWF","frames",".","If","0","then","standard","MCWF",".","tik_eps","(","float",")",":","diagonal","loading","for","matrix","inversion","in","MCWF","computation",".","Returns",":","beamformed","(","torch.Tensor",")",":","monaural","STFT","complex","estimate","of","target","source","after","MFMCWF","[","B",",","T",",","F","]","batch",",","frames",",","frequencies","."]
code: def mfmcwf(mixture, estimate, n_chunks, tik_eps):
      """multi-frame multi-channel wiener filter.
  
      Args:
          mixture (torch.Tensor): multi-channel STFT complex mixture tensor,
              of shape [B, T, C, F] batch, frames, microphones, frequencies.
          estimate (torch.Tensor): monaural STFT complex estimate
              of target source [B, T, F] batch, frames, frequencies.
          n_chunks (int): number of past and future mfMCWF frames.
              If 0 then standard MCWF.
          tik_eps (float): diagonal loading for matrix inversion in MCWF computation.
  
      Returns:
          beamformed (torch.Tensor): monaural STFT complex estimate
              of target source after MFMCWF [B, T, F] batch, frames, frequencies.
      """
      mixture = mixture.permute(0, 2, 3, 1)
      estimate = estimate.transpose(-1, -2)
  
      bsz, mics, _, frames = mixture.shape
  
      mix_unfolded = iNeuBe.unfold(
          mixture.reshape(bsz * mics, -1, frames), n_chunks
      ).reshape(bsz, mics * (2 * n_chunks + 1), -1, frames)
  
      mix_unfolded = to_double(mix_unfolded)
      estimate1 = to_double(estimate)
      zeta = torch.einsum(
          "bmft, bft->bmf", mix_unfolded, estimate1.conj()
      )
      scm_mix = torch.einsum(
          "bmft, bnft->bmnf", mix_unfolded, mix_unfolded.conj()
      )
      inv_scm_mix = torch.inverse(
          tik_reg(scm_mix.permute(0, 3, 1, 2), tik_eps)
      ).permute(0, 2, 3, 1)
      bf_vector = torch.einsum("bmnf, bnf->bmf", inv_scm_mix, zeta)
  
      beamformed = torch.einsum(
          "...mf,...mft->...ft", bf_vector.conj(), mix_unfolded
      )
      beamformed = beamformed.to(mixture)
  
      return beamformed.transpose(-1, -2)
  
file_path: espnet/espnet2/enh/separator/ineube_separator.py
imports: from collections import OrderedDict
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from packaging.version import parse
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.decoder.stft_decoder import STFTDecoder
  from espnet2.enh.encoder.stft_encoder import STFTEncoder
  from espnet2.enh.layers.beamformer import tik_reg, to_double
  from espnet2.enh.layers.tcndenseunet import TCNDenseUNet
  from espnet2.enh.separator.abs_separator import AbsSeparator
label_desc: Use image node_id 3 for calling the iNeuBe obj's underlying member method code with example usage: obj.mfmcwf(mixture, estimate, n_chunks, tik_eps) and returns: beamformed