class_docstr: PWGAN generator as in https://arxiv.org/pdf/1910.11480.pdf.
  It is similar to WaveNet with no causal convolution.
      It is conditioned on an aux feature (spectrogram) to generate
  an output waveform from an input noise.
class_docstr_tok: ["PWGAN","generator","as","in","https",":","\/\/arxiv.org\/pdf\/1910.11480.pdf",".","It","is","similar","to","WaveNet","with","no","causal","convolution",".","It","is","conditioned","on","an","aux","feature","(","spectrogram",")","to","generate","an","output","waveform","from","an","input","noise","."]
code: def __init__(
      self,
      in_channels=1,
      out_channels=1,
      kernel_size=3,
      num_res_blocks=30,
      stacks=3,
      res_channels=64,
      gate_channels=128,
      skip_channels=64,
      aux_channels=80,
      dropout=0.0,
      bias=True,
      use_weight_norm=True,
      upsample_factors=[4, 4, 4, 4],
      inference_padding=2,
  ):
      super(ParallelWaveganGenerator, self).__init__()
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.aux_channels = aux_channels
      self.num_res_blocks = num_res_blocks
      self.stacks = stacks
      self.kernel_size = kernel_size
      self.upsample_factors = upsample_factors
      self.upsample_scale = np.prod(upsample_factors)
      self.inference_padding = inference_padding
      self.use_weight_norm = use_weight_norm
  
      # check the number of layers and stacks
      assert num_res_blocks % stacks == 0
      layers_per_stack = num_res_blocks // stacks
  
      # define first convolution
      self.first_conv = torch.nn.Conv1d(
          in_channels, res_channels, kernel_size=1, bias=True
      )
  
      # define conv + upsampling network
      self.upsample_net = ConvUpsample(
          upsample_factors=upsample_factors
      )
  
      # define residual blocks
      self.conv_layers = torch.nn.ModuleList()
      for layer in range(num_res_blocks):
          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=aux_channels,
              dilation=dilation,
              dropout=dropout,
              bias=bias,
          )
          self.conv_layers += [conv]
  
      # define output layers
      self.last_conv_layers = torch.nn.ModuleList(
          [
              torch.nn.ReLU(inplace=True),
              torch.nn.Conv1d(
                  skip_channels, skip_channels, kernel_size=1, bias=True
              ),
              torch.nn.ReLU(inplace=True),
              torch.nn.Conv1d(
                  skip_channels, out_channels, kernel_size=1, bias=True
              ),
          ]
      )
  
      # apply weight norm
      if use_weight_norm:
          self.apply_weight_norm()
  
file_path: TTS/TTS/vocoder/models/parallel_wavegan_generator.py
imports: import math
  import numpy
  import torch
  from TTS.vocoder.layers.parallel_wavegan import ResidualBlock
  from TTS.vocoder.layers.upsample import ConvUpsample
label_desc: Use image node_id 1 to create a new ParallelWaveganGenerator object from inherited base classes: torch.nn with example: obj = ParallelWaveganGenerator(in_channels, out_channels, kernel_size, num_res_blocks, stacks, res_channels, gate_channels, skip_channels, aux_channels, dropout, bias, use_weight_norm, upsample_factors, inference_padding)