docstr: Basic Module of tasnet.
  
  Args:
      N: Number of filters in autoencoder
      B: Number of channels in bottleneck 1 * 1-conv block
      H: Number of channels in convolutional blocks
      P: Kernel size in convolutional blocks
      X: Number of convolutional blocks in each repeat
      R: Number of repeats
      C: Number of speakers
      Sc: Number of channels in skip-connection paths' 1x1-conv blocks
      out_channel: Number of output channels
          if it is None, `N` will be used instead.
      norm_type: BN, gLN, cLN
      causal: causal or non-causal
      pre_mask_nonlinear: the non-linear function before masknet
      mask_nonlinear: use which non-linear function to generate mask
docstr_tok: ["Basic","Module","of","tasnet",".","Args",":","N",":","Number","of","filters","in","autoencoder","B",":","Number","of","channels","in","bottleneck","1","*","1-conv","block","H",":","Number","of","channels","in","convolutional","blocks","P",":","Kernel","size","in","convolutional","blocks","X",":","Number","of","convolutional","blocks","in","each","repeat","R",":","Number","of","repeats","C",":","Number","of","speakers","Sc",":","Number","of","channels","in","skip-connection","paths","'","1x1-conv","blocks","out_channel",":","Number","of","output","channels","if","it","is","None",",","`","N","`","will","be","used","instead",".","norm_type",":","BN",",","gLN",",","cLN","causal",":","causal","or","non-causal","pre_mask_nonlinear",":","the","non-linear","function","before","masknet","mask_nonlinear",":","use","which","non-linear","function","to","generate","mask"]
code: def __init__(
      self,
      N,
      B,
      H,
      P,
      X,
      R,
      C,
      Sc=None,
      out_channel=None,
      norm_type="gLN",
      causal=False,
      pre_mask_nonlinear="linear",
      mask_nonlinear="relu",
  ):
      """Basic Module of tasnet.
  
      Args:
          N: Number of filters in autoencoder
          B: Number of channels in bottleneck 1 * 1-conv block
          H: Number of channels in convolutional blocks
          P: Kernel size in convolutional blocks
          X: Number of convolutional blocks in each repeat
          R: Number of repeats
          C: Number of speakers
          Sc: Number of channels in skip-connection paths' 1x1-conv blocks
          out_channel: Number of output channels
              if it is None, `N` will be used instead.
          norm_type: BN, gLN, cLN
          causal: causal or non-causal
          pre_mask_nonlinear: the non-linear function before masknet
          mask_nonlinear: use which non-linear function to generate mask
      """
      super().__init__()
      # Hyper-parameter
      self.C = C
      self.mask_nonlinear = mask_nonlinear
      self.skip_connection = Sc is not None
      self.out_channel = N if out_channel is None else out_channel
      if self.skip_connection:
          assert Sc == B, (Sc, B)
      # Components
      # [M, N, K] -> [M, N, K]
      layer_norm = ChannelwiseLayerNorm(N)
      # [M, N, K] -> [M, B, K]
      bottleneck_conv1x1 = nn.Conv1d(N, B, 1, bias=False)
      # [M, B, K] -> [M, B, K]
      repeats = []
  
      self.receptive_field = 0
      for r in range(R):
          blocks = []
          for x in range(X):
              dilation = 2**x
              if r == 0 and x == 0:
                  self.receptive_field += P
              else:
                  self.receptive_field += (P - 1) * dilation
              padding = (
                  (P - 1) * dilation
                  if causal
                  else (P - 1) * dilation // 2
              )
              blocks += [
                  TemporalBlock(
                      B,
                      H,
                      Sc,
                      P,
                      stride=1,
                      padding=padding,
                      dilation=dilation,
                      norm_type=norm_type,
                      causal=causal,
                  )
              ]
          repeats += [nn.Sequential(*blocks)]
      temporal_conv_net = nn.Sequential(*repeats)
      # [M, B, K] -> [M, C*N, K]
      mask_conv1x1 = nn.Conv1d(B, C * self.out_channel, 1, bias=False)
      # Put together (for compatibility with older versions)
      if pre_mask_nonlinear == "linear":
          self.network = nn.Sequential(
              layer_norm,
              bottleneck_conv1x1,
              temporal_conv_net,
              mask_conv1x1,
          )
      else:
          activ = {
              "prelu": nn.PReLU(),
              "relu": nn.ReLU(),
              "tanh": nn.Tanh(),
              "sigmoid": nn.Sigmoid(),
          }[pre_mask_nonlinear]
          self.network = nn.Sequential(
              layer_norm,
              bottleneck_conv1x1,
              temporal_conv_net,
              activ,
              mask_conv1x1,
          )
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from espnet2.enh.layers.adapt_layers import make_adapt_layer
label_desc: Use image node_id 1 to create a new TemporalConvNet object from inherited base classes: nn with example: obj = TemporalConvNet(N, B, H, P, X, R, C, Sc, out_channel, norm_type, causal, pre_mask_nonlinear, mask_nonlinear)