code: def __init__(
      self,
      in_channels=1,
      out_channels=1,
      kernel_size=3,
      num_layers=30,
      stacks=3,
      res_channels=64,
      gate_channels=128,
      skip_channels=64,
      dropout=0.0,
      bias=True,
      nonlinear_activation="LeakyReLU",
      nonlinear_activation_params={"negative_slope": 0.2},
  ):
      super(ResidualParallelWaveganDiscriminator, self).__init__()
      assert (
          kernel_size - 1
      ) % 2 == 0, "Not support even number kernel size."
  
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.num_layers = num_layers
      self.stacks = stacks
      self.kernel_size = kernel_size
      self.res_factor = math.sqrt(1.0 / num_layers)
  
      # check the number of num_layers and stacks
      assert num_layers % stacks == 0
      layers_per_stack = num_layers // stacks
  
      # define first convolution
      self.first_conv = nn.Sequential(
          nn.Conv1d(
              in_channels,
              res_channels,
              kernel_size=1,
              padding=0,
              dilation=1,
              bias=True,
          ),
          getattr(nn, nonlinear_activation)(
              inplace=True, **nonlinear_activation_params
          ),
      )
  
      # define residual blocks
      self.conv_layers = nn.ModuleList()
      for layer in range(num_layers):
          dilation = 2 ** (layer % layers_per_stack)
          conv = ResidualBlock(
              kernel_size=kernel_size,
              res_channels=res_channels,
              gate_channels=gate_channels,
              skip_channels=skip_channels,
              aux_channels=-1,
              dilation=dilation,
              dropout=dropout,
              bias=bias,
              use_causal_conv=False,
          )
          self.conv_layers += [conv]
  
      # define output layers
      self.last_conv_layers = nn.ModuleList(
          [
              getattr(nn, nonlinear_activation)(
                  inplace=True, **nonlinear_activation_params
              ),
              nn.Conv1d(
                  skip_channels,
                  skip_channels,
                  kernel_size=1,
                  padding=0,
                  dilation=1,
                  bias=True,
              ),
              getattr(nn, nonlinear_activation)(
                  inplace=True, **nonlinear_activation_params
              ),
              nn.Conv1d(
                  skip_channels,
                  out_channels,
                  kernel_size=1,
                  padding=0,
                  dilation=1,
                  bias=True,
              ),
          ]
      )
  
      # apply weight norm
      self.apply_weight_norm()
  
file_path: TTS/TTS/vocoder/models/parallel_wavegan_discriminator.py
imports: import math
  import torch
  from torch import nn
  from TTS.vocoder.layers.parallel_wavegan import ResidualBlock
label_desc: Use image node_id 1 to create a new ResidualParallelWaveganDiscriminator object from inherited base classes: nn with example: obj = ResidualParallelWaveganDiscriminator(in_channels, out_channels, kernel_size, num_layers, stacks, res_channels, gate_channels, skip_channels, dropout, bias, nonlinear_activation, nonlinear_activation_params)