class_docstr: Parallel WaveGAN Discriminator module.
docstr: Initialize ParallelWaveGANDiscriminator module.
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      kernel_size (int): Number of output channels.
      layers (int): Number of conv layers.
      conv_channels (int): Number of chnn layers.
      dilation_factor (int): Dilation factor. For example, if dilation_factor = 2,
          the dilation will be 2, 4, 8, ..., and so on.
      nonlinear_activation (str): Nonlinear function after each conv.
      nonlinear_activation_params (Dict[str, Any]): Nonlinear function parameters
      bias (bool): Whether to use bias parameter in conv.
      use_weight_norm (bool) Whether to use weight norm.
          If set to true, it will be applied to all of the conv layers.
docstr_tok: ["Initialize","ParallelWaveGANDiscriminator","module",".","Args",":","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","kernel_size","(","int",")",":","Number","of","output","channels",".","layers","(","int",")",":","Number","of","conv","layers",".","conv_channels","(","int",")",":","Number","of","chnn","layers",".","dilation_factor","(","int",")",":","Dilation","factor",".","For","example",",","if","dilation_factor","=","2",",","the","dilation","will","be","2",",","4",",","8",",","...",",","and","so","on",".","nonlinear_activation","(","str",")",":","Nonlinear","function","after","each","conv",".","nonlinear_activation_params","(","Dict","[","str",",","Any","]",")",":","Nonlinear","function","parameters","bias","(","bool",")",":","Whether","to","use","bias","parameter","in","conv",".","use_weight_norm","(","bool",")","Whether","to","use","weight","norm",".","If","set","to","true",",","it","will","be","applied","to","all","of","the","conv","layers","."]
code: def __init__(
      self,
      in_channels: int = 1,
      out_channels: int = 1,
      kernel_size: int = 3,
      layers: int = 10,
      conv_channels: int = 64,
      dilation_factor: int = 1,
      nonlinear_activation: str = "LeakyReLU",
      nonlinear_activation_params: Dict[str, Any] = {
          "negative_slope": 0.2
      },
      bias: bool = True,
      use_weight_norm: bool = True,
  ):
      """Initialize ParallelWaveGANDiscriminator module.
  
      Args:
          in_channels (int): Number of input channels.
          out_channels (int): Number of output channels.
          kernel_size (int): Number of output channels.
          layers (int): Number of conv layers.
          conv_channels (int): Number of chnn layers.
          dilation_factor (int): Dilation factor. For example, if dilation_factor = 2,
              the dilation will be 2, 4, 8, ..., and so on.
          nonlinear_activation (str): Nonlinear function after each conv.
          nonlinear_activation_params (Dict[str, Any]): Nonlinear function parameters
          bias (bool): Whether to use bias parameter in conv.
          use_weight_norm (bool) Whether to use weight norm.
              If set to true, it will be applied to all of the conv layers.
  
      """
      super().__init__()
      assert (
          kernel_size - 1
      ) % 2 == 0, "Not support even number kernel size."
      assert dilation_factor > 0, "Dilation factor must be > 0."
      self.conv_layers = torch.nn.ModuleList()
      conv_in_channels = in_channels
      for i in range(layers - 1):
          if i == 0:
              dilation = 1
          else:
              dilation = (
                  i if dilation_factor == 1 else dilation_factor**i
              )
              conv_in_channels = conv_channels
          padding = (kernel_size - 1) // 2 * dilation
          conv_layer = [
              Conv1d(
                  conv_in_channels,
                  conv_channels,
                  kernel_size=kernel_size,
                  padding=padding,
                  dilation=dilation,
                  bias=bias,
              ),
              getattr(torch.nn, nonlinear_activation)(
                  inplace=True, **nonlinear_activation_params
              ),
          ]
          self.conv_layers += conv_layer
      padding = (kernel_size - 1) // 2
      last_conv_layer = Conv1d(
          conv_in_channels,
          out_channels,
          kernel_size=kernel_size,
          padding=padding,
          bias=bias,
      )
      self.conv_layers += [last_conv_layer]
  
      # apply weight norm
      if use_weight_norm:
          self.apply_weight_norm()
  
imports: import logging
  import math
  from typing import Any, Dict, Optional
  import numpy
  import torch
  from espnet2.gan_tts.parallel_wavegan import upsample
  from espnet2.gan_tts.wavenet.residual_block import Conv1d, Conv1d1x1, ResidualBlock
label_desc: Use image node_id 1 to create a new ParallelWaveGANDiscriminator object from inherited base classes: torch.nn with example: obj = ParallelWaveGANDiscriminator(in_channels, out_channels, kernel_size, layers, conv_channels, dilation_factor, nonlinear_activation, nonlinear_activation_params, bias, use_weight_norm)