docstr: Deep Attractor Network Separator
  
  Reference:
      DEEP ATTRACTOR NETWORK FOR SINGLE-MICROPHONE SPEAKER SEPARATION;
      Zhuo Chen. et al., 2017;
      https://pubmed.ncbi.nlm.nih.gov/29430212/
  
  Args:
      input_dim: input feature dimension
      rnn_type: string, select from 'blstm', 'lstm' etc.
      bidirectional: bool, whether the inter-chunk RNN layers are bidirectional.
      num_spk: number of speakers
      nonlinear: the nonlinear function for mask estimation,
                 select from 'relu', 'tanh', 'sigmoid'
      layer: int, number of stacked RNN layers. Default is 3.
      unit: int, dimension of the hidden state.
      emb_D: int, dimension of the attribute vector for one tf-bin.
      dropout: float, dropout ratio. Default is 0.
docstr_tok: ["Deep","Attractor","Network","Separator","Reference",":","DEEP","ATTRACTOR","NETWORK","FOR","SINGLE-MICROPHONE","SPEAKER","SEPARATION",";","Zhuo","Chen",".","et","al.",",","2017",";","https",":","\/\/pubmed.ncbi.nlm.nih.gov\/29430212\/","Args",":","input_dim",":","input","feature","dimension","rnn_type",":","string",",","select","from","'blstm","'",",","'lstm","'","etc",".","bidirectional",":","bool",",","whether","the","inter-chunk","RNN","layers","are","bidirectional",".","num_spk",":","number","of","speakers","nonlinear",":","the","nonlinear","function","for","mask","estimation",",","select","from","'relu","'",",","'tanh","'",",","'sigmoid'","layer",":","int",",","number","of","stacked","RNN","layers",".","Default","is","3.","unit",":","int",",","dimension","of","the","hidden","state",".","emb_D",":","int",",","dimension","of","the","attribute","vector","for","one","tf-bin",".","dropout",":","float",",","dropout","ratio",".","Default","is","0","."]
code: def __init__(
      self,
      input_dim: int,
      rnn_type: str = "blstm",
      num_spk: int = 2,
      nonlinear: str = "tanh",
      layer: int = 2,
      unit: int = 512,
      emb_D: int = 40,
      dropout: float = 0.0,
  ):
      """Deep Attractor Network Separator
  
      Reference:
          DEEP ATTRACTOR NETWORK FOR SINGLE-MICROPHONE SPEAKER SEPARATION;
          Zhuo Chen. et al., 2017;
          https://pubmed.ncbi.nlm.nih.gov/29430212/
  
      Args:
          input_dim: input feature dimension
          rnn_type: string, select from 'blstm', 'lstm' etc.
          bidirectional: bool, whether the inter-chunk RNN layers are bidirectional.
          num_spk: number of speakers
          nonlinear: the nonlinear function for mask estimation,
                     select from 'relu', 'tanh', 'sigmoid'
          layer: int, number of stacked RNN layers. Default is 3.
          unit: int, dimension of the hidden state.
          emb_D: int, dimension of the attribute vector for one tf-bin.
          dropout: float, dropout ratio. Default is 0.
      """
      super().__init__()
  
      self._num_spk = num_spk
  
      self.blstm = RNN(
          idim=input_dim,
          elayers=layer,
          cdim=unit,
          hdim=unit,
          dropout=dropout,
          typ=rnn_type,
      )
  
      self.linear = torch.nn.Linear(unit, input_dim * emb_D)
  
      if nonlinear not in ("sigmoid", "relu", "tanh"):
          raise ValueError(
              "Not supporting nonlinear={}".format(nonlinear)
          )
  
      self.nonlinear = {
          "sigmoid": torch.nn.Sigmoid(),
          "relu": torch.nn.ReLU(),
          "tanh": torch.nn.Tanh(),
      }[nonlinear]
  
      self.D = emb_D
  
file_path: espnet/espnet2/enh/separator/dan_separator.py
imports: from collections import OrderedDict
  from functools import reduce
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  import torch.nn.functional
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.layers.complex_utils import is_complex
  from espnet2.enh.separator.abs_separator import AbsSeparator
  from espnet.nets.pytorch_backend.rnn.encoders import RNN
label_desc: Use image node_id 1 to create a new DANSeparator object from inherited base classes: AbsSeparator with example: obj = DANSeparator(input_dim, rnn_type, num_spk, nonlinear, layer, unit, emb_D, dropout)