code: def __init__(
      self,
      input_dim: int,
      num_spk: int = 1,
      loss_type: str = "mask_mse",
      # Dereverberation options
      use_wpe: bool = False,
      wnet_type: str = "blstmp",
      wlayers: int = 3,
      wunits: int = 300,
      wprojs: int = 320,
      wdropout_rate: float = 0.0,
      taps: int = 5,
      delay: int = 3,
      use_dnn_mask_for_wpe: bool = True,
      wnonlinear: str = "crelu",
      multi_source_wpe: bool = True,
      wnormalization: bool = False,
      # Beamformer options
      use_beamformer: bool = True,
      bnet_type: str = "blstmp",
      blayers: int = 3,
      bunits: int = 300,
      bprojs: int = 320,
      badim: int = 320,
      ref_channel: int = -1,
      use_noise_mask: bool = True,
      bnonlinear: str = "sigmoid",
      beamformer_type: str = "mvdr_souden",
      rtf_iterations: int = 2,
      bdropout_rate: float = 0.0,
      shared_power: bool = True,
      use_torchaudio_api: bool = False,
      # For numerical stability
      diagonal_loading: bool = True,
      diag_eps_wpe: float = 1e-7,
      diag_eps_bf: float = 1e-7,
      mask_flooring: bool = False,
      flooring_thres_wpe: float = 1e-6,
      flooring_thres_bf: float = 1e-6,
      use_torch_solver: bool = True,
  ):
      super().__init__()
  
      self._num_spk = num_spk
      self.loss_type = loss_type
      if loss_type not in (
          "mask_mse",
          "spectrum",
          "spectrum_log",
          "magnitude",
      ):
          raise ValueError("Unsupported loss type: %s" % loss_type)
  
      self.use_beamformer = use_beamformer
      self.use_wpe = use_wpe
  
      if self.use_wpe:
          if use_dnn_mask_for_wpe:
              # Use DNN for power estimation
              iterations = 1
          else:
              # Performing as conventional WPE, without DNN Estimator
              iterations = 2
  
          self.wpe = DNN_WPE(
              wtype=wnet_type,
              widim=input_dim,
              wlayers=wlayers,
              wunits=wunits,
              wprojs=wprojs,
              dropout_rate=wdropout_rate,
              taps=taps,
              delay=delay,
              use_dnn_mask=use_dnn_mask_for_wpe,
              nmask=1 if multi_source_wpe else num_spk,
              nonlinear=wnonlinear,
              iterations=iterations,
              normalization=wnormalization,
              diagonal_loading=diagonal_loading,
              diag_eps=diag_eps_wpe,
              mask_flooring=mask_flooring,
              flooring_thres=flooring_thres_wpe,
              use_torch_solver=use_torch_solver,
          )
      else:
          self.wpe = None
  
      self.ref_channel = ref_channel
      if self.use_beamformer:
          self.beamformer = DNN_Beamformer(
              bidim=input_dim,
              btype=bnet_type,
              blayers=blayers,
              bunits=bunits,
              bprojs=bprojs,
              num_spk=num_spk,
              use_noise_mask=use_noise_mask,
              nonlinear=bnonlinear,
              dropout_rate=bdropout_rate,
              badim=badim,
              ref_channel=ref_channel,
              beamformer_type=beamformer_type,
              rtf_iterations=rtf_iterations,
              btaps=taps,
              bdelay=delay,
              diagonal_loading=diagonal_loading,
              diag_eps=diag_eps_bf,
              mask_flooring=mask_flooring,
              flooring_thres=flooring_thres_bf,
              use_torch_solver=use_torch_solver,
              use_torchaudio_api=use_torchaudio_api,
          )
      else:
          self.beamformer = None
  
      # share speech powers between WPE and beamforming (wMPDR/WPD)
      self.shared_power = shared_power and use_wpe
  
file_path: espnet/espnet2/enh/separator/neural_beamformer.py
imports: from collections import OrderedDict
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.layers.dnn_beamformer import DNN_Beamformer
  from espnet2.enh.layers.dnn_wpe import DNN_WPE
  from espnet2.enh.separator.abs_separator import AbsSeparator
label_desc: Use image node_id 1 to create a new NeuralBeamformer object from inherited base classes: AbsSeparator with example: obj = NeuralBeamformer(input_dim, num_spk, loss_type, use_wpe, wnet_type, wlayers, wunits, wprojs, wdropout_rate, taps, delay, use_dnn_mask_for_wpe, wnonlinear, multi_source_wpe, wnormalization, use_beamformer, bnet_type, blayers, bunits, bprojs, badim, ref_channel, use_noise_mask, bnonlinear, beamformer_type, rtf_iterations, bdropout_rate, shared_power, use_torchaudio_api, diagonal_loading, diag_eps_wpe, diag_eps_bf, mask_flooring, flooring_thres_wpe, flooring_thres_bf, use_torch_solver)