docstr: Initialize HiFiGANGenerator module.
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      channels (int): Number of hidden representation channels.
      global_channels (int): Number of global conditioning channels.
      kernel_size (int): Kernel size of initial and final conv layer.
      upsample_scales (List[int]): List of upsampling scales.
      upsample_kernel_sizes (List[int]): List of kernel sizes for upsample layers.
      resblock_kernel_sizes (List[int]): List of kernel sizes for residual blocks.
      resblock_dilations (List[List[int]]): List of list of dilations for residual
          blocks.
      n_harmonic (int): Number of harmonics used to synthesize a sound signal.
      use_additional_convs (bool): Whether to use additional conv layers in
          residual blocks.
      bias (bool): Whether to add bias parameter in convolution layers.
      nonlinear_activation (str): Activation function module name.
      nonlinear_activation_params (Dict[str, Any]): Hyperparameters for activation
          function.
      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 = 80,
      out_channels: int = 1,
      channels: int = 512,
      global_channels: int = -1,
      kernel_size: int = 7,
      upsample_scales: List[int] = [8, 8, 2, 2],
      upsample_kernel_sizes: List[int] = [16, 16, 4, 4],
      resblock_kernel_sizes: List[int] = [3, 7, 11],
      resblock_dilations: List[List[int]] = [
          [1, 3, 5],
          [1, 3, 5],
          [1, 3, 5],
      ],
      n_harmonic: int = 64,
      use_additional_convs: bool = True,
      bias: bool = True,
      nonlinear_activation: str = "LeakyReLU",
      nonlinear_activation_params: Dict[str, Any] = {
          "negative_slope": 0.1
      },
      use_weight_norm: bool = True,
  ):
      """Initialize HiFiGANGenerator module.
  
      Args:
          in_channels (int): Number of input channels.
          out_channels (int): Number of output channels.
          channels (int): Number of hidden representation channels.
          global_channels (int): Number of global conditioning channels.
          kernel_size (int): Kernel size of initial and final conv layer.
          upsample_scales (List[int]): List of upsampling scales.
          upsample_kernel_sizes (List[int]): List of kernel sizes for upsample layers.
          resblock_kernel_sizes (List[int]): List of kernel sizes for residual blocks.
          resblock_dilations (List[List[int]]): List of list of dilations for residual
              blocks.
          n_harmonic (int): Number of harmonics used to synthesize a sound signal.
          use_additional_convs (bool): Whether to use additional conv layers in
              residual blocks.
          bias (bool): Whether to add bias parameter in convolution layers.
          nonlinear_activation (str): Activation function module name.
          nonlinear_activation_params (Dict[str, Any]): Hyperparameters for activation
              function.
          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__()
  
      # check hyperparameters are valid
      assert kernel_size % 2 == 1, "Kernel size must be odd number."
      assert len(upsample_scales) == len(upsample_kernel_sizes)
      assert len(resblock_dilations) == len(resblock_kernel_sizes)
  
      # define modules
      self.upsample_factor = int(
          np.prod(upsample_scales) * out_channels
      )
      self.num_upsamples = len(upsample_kernel_sizes)
      self.num_blocks = len(resblock_kernel_sizes)
      self.input_conv = torch.nn.Conv1d(
          in_channels,
          channels,
          kernel_size,
          1,
          padding=(kernel_size - 1) // 2,
      )
      self.upsample_scales = upsample_scales
  
      self.downs = torch.nn.ModuleList()
      for i, (u, k) in enumerate(
          zip(upsample_scales, upsample_kernel_sizes)
      ):
          i = self.num_upsamples - 1 - i
          u = upsample_scales[i]
          k = upsample_kernel_sizes[i]
          down = torch.nn.Conv1d(
              n_harmonic + 2,
              n_harmonic + 2,
              k,
              u,
              padding=k // 2,
          )
          self.downs.append(down)
  
      self.blocks_downs = torch.nn.ModuleList()
      for i in range(len(self.downs)):
          j = self.num_upsamples - 1 - i
  
          self.blocks_downs += [
              ResidualBlock(
                  kernel_size=3,
                  channels=n_harmonic + 2,
                  dilations=(1, 3),
                  bias=bias,
                  use_additional_convs=False,
                  nonlinear_activation=nonlinear_activation,
                  nonlinear_activation_params=nonlinear_activation_params,
              )
          ]
  
      self.concat_pre = torch.nn.Conv1d(
          channels + n_harmonic + 2,
          channels,
          3,
          1,
          padding=1,
      )
      self.concat_conv = torch.nn.ModuleList()
      for i in range(self.num_upsamples):
          ch = channels // (2 ** (i + 1))
          self.concat_conv.append(
              torch.nn.Conv1d(
                  ch + n_harmonic + 2, ch, 3, 1, padding=1, bias=bias
              )
          )
  
      self.upsamples = torch.nn.ModuleList()
      self.blocks = torch.nn.ModuleList()
      for i in range(len(upsample_kernel_sizes)):
          assert upsample_kernel_sizes[i] == 2 * upsample_scales[i]
          self.upsamples += [
              torch.nn.Sequential(
                  getattr(torch.nn, nonlinear_activation)(
                      **nonlinear_activation_params
                  ),
                  torch.nn.ConvTranspose1d(
                      channels // (2**i),
                      channels // (2 ** (i + 1)),
                      upsample_kernel_sizes[i],
                      upsample_scales[i],
                      padding=upsample_scales[i] // 2
                      + upsample_scales[i] % 2,
                      output_padding=upsample_scales[i] % 2,
                  ),
              )
          ]
          for j in range(len(resblock_kernel_sizes)):
              self.blocks += [
                  ResidualBlock(
                      kernel_size=resblock_kernel_sizes[j],
                      channels=channels // (2 ** (i + 1)),
                      dilations=resblock_dilations[j],
                      bias=bias,
                      use_additional_convs=use_additional_convs,
                      nonlinear_activation=nonlinear_activation,
                      nonlinear_activation_params=nonlinear_activation_params,
                  )
              ]
      self.output_conv = torch.nn.Sequential(
          # NOTE(kan-bayashi): follow official implementation but why
          #   using different slope parameter here? (0.1 vs. 0.01)
          torch.nn.LeakyReLU(),
          torch.nn.Conv1d(
              channels // (2 ** (i + 1)),
              out_channels,
              kernel_size,
              1,
              padding=(kernel_size - 1) // 2,
          ),
          torch.nn.Tanh(),
      )
      if global_channels > 0:
          self.global_conv = torch.nn.Conv1d(
              global_channels, channels, 1
          )
  
      # apply weight norm
      if use_weight_norm:
          self.apply_weight_norm()
  
      # reset parameters
      self.reset_parameters()
  
imports: import logging
  import math
  from typing import Any, Dict, List, Optional
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_svs.visinger2.ddsp import remove_above_nyquist, scale_function, upsample
  from espnet2.gan_tts.hifigan import HiFiGANMultiPeriodDiscriminator, HiFiGANMultiScaleDiscriminator, HiFiGANMultiScaleMultiPeriodDiscriminator, HiFiGANPeriodDiscriminator, HiFiGANScaleDiscriminator
  from espnet2.gan_tts.hifigan.residual_block import ResidualBlock
label_desc: Use image node_id 1 to create a new VISinger2VocoderGenerator object from inherited base classes: torch.nn with example: obj = VISinger2VocoderGenerator(in_channels, out_channels, channels, global_channels, kernel_size, upsample_scales, upsample_kernel_sizes, resblock_kernel_sizes, resblock_dilations, n_harmonic, use_additional_convs, bias, nonlinear_activation, nonlinear_activation_params, use_weight_norm)