docstr: Dual-Path Transformer Network (DPTNet) Separator
  
  Args:
      input_dim: input feature dimension
      rnn_type: string, select from 'RNN', 'LSTM' and 'GRU'.
      bidirectional: bool, whether the inter-chunk RNN layers are bidirectional.
      num_spk: number of speakers
      predict_noise: whether to output the estimated noise signal
      unit: int, dimension of the hidden state.
      att_heads: number of attention heads.
      dropout: float, dropout ratio. Default is 0.
      activation: activation function applied at the output of RNN.
      norm_type: type of normalization to use after each inter- or
          intra-chunk Transformer block.
      nonlinear: the nonlinear function for mask estimation,
                 select from 'relu', 'tanh', 'sigmoid'
      layer: int, number of stacked RNN layers. Default is 3.
      segment_size: dual-path segment size
docstr_tok: ["Dual-Path","Transformer","Network","(","DPTNet",")","Separator","Args",":","input_dim",":","input","feature","dimension","rnn_type",":","string",",","select","from","'RNN","'",",","'LSTM","'","and","'GRU","'",".","bidirectional",":","bool",",","whether","the","inter-chunk","RNN","layers","are","bidirectional",".","num_spk",":","number","of","speakers","predict_noise",":","whether","to","output","the","estimated","noise","signal","unit",":","int",",","dimension","of","the","hidden","state",".","att_heads",":","number","of","attention","heads",".","dropout",":","float",",","dropout","ratio",".","Default","is","0.","activation",":","activation","function","applied","at","the","output","of","RNN",".","norm_type",":","type","of","normalization","to","use","after","each","inter-","or","intra-chunk","Transformer","block",".","nonlinear",":","the","nonlinear","function","for","mask","estimation",",","select","from","'relu","'",",","'tanh","'",",","'sigmoid'","layer",":","int",",","number","of","stacked","RNN","layers",".","Default","is","3.","segment_size",":","dual-path","segment","size"]
code: def __init__(
      self,
      input_dim: int,
      post_enc_relu: bool = True,
      rnn_type: str = "lstm",
      bidirectional: bool = True,
      num_spk: int = 2,
      predict_noise: bool = False,
      unit: int = 256,
      att_heads: int = 4,
      dropout: float = 0.0,
      activation: str = "relu",
      norm_type: str = "gLN",
      layer: int = 6,
      segment_size: int = 20,
      nonlinear: str = "relu",
  ):
      """Dual-Path Transformer Network (DPTNet) Separator
  
      Args:
          input_dim: input feature dimension
          rnn_type: string, select from 'RNN', 'LSTM' and 'GRU'.
          bidirectional: bool, whether the inter-chunk RNN layers are bidirectional.
          num_spk: number of speakers
          predict_noise: whether to output the estimated noise signal
          unit: int, dimension of the hidden state.
          att_heads: number of attention heads.
          dropout: float, dropout ratio. Default is 0.
          activation: activation function applied at the output of RNN.
          norm_type: type of normalization to use after each inter- or
              intra-chunk Transformer block.
          nonlinear: the nonlinear function for mask estimation,
                     select from 'relu', 'tanh', 'sigmoid'
          layer: int, number of stacked RNN layers. Default is 3.
          segment_size: dual-path segment size
      """
      super().__init__()
  
      self._num_spk = num_spk
      self.predict_noise = predict_noise
      self.segment_size = segment_size
  
      self.post_enc_relu = post_enc_relu
      self.enc_LN = choose_norm(norm_type, input_dim)
      self.num_outputs = (
          self.num_spk + 1 if self.predict_noise else self.num_spk
      )
      self.dptnet = DPTNet(
          rnn_type=rnn_type,
          input_size=input_dim,
          hidden_size=unit,
          output_size=input_dim * self.num_outputs,
          att_heads=att_heads,
          dropout=dropout,
          activation=activation,
          num_layers=layer,
          bidirectional=bidirectional,
          norm_type=norm_type,
      )
      # gated output layer
      self.output = torch.nn.Sequential(
          torch.nn.Conv1d(input_dim, input_dim, 1), torch.nn.Tanh()
      )
      self.output_gate = torch.nn.Sequential(
          torch.nn.Conv1d(input_dim, input_dim, 1), torch.nn.Sigmoid()
      )
  
      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]
  
file_path: espnet/espnet2/enh/separator/dptnet_separator.py
imports: from collections import OrderedDict
  from distutils.version import LooseVersion
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from torch_complex.tensor import ComplexTensor
  from espnet2.enh.layers.complex_utils import is_complex
  from espnet2.enh.layers.dptnet import DPTNet
  from espnet2.enh.layers.tcn import choose_norm
  from espnet2.enh.separator.abs_separator import AbsSeparator
label_desc: Use image node_id 1 to create a new DPTNetSeparator object from inherited base classes: AbsSeparator with example: obj = DPTNetSeparator(input_dim, post_enc_relu, rnn_type, bidirectional, num_spk, predict_noise, unit, att_heads, dropout, activation, norm_type, layer, segment_size, nonlinear)