class_docstr: HiFi-GAN multi-scale discriminator module.
docstr: Initilize HiFiGAN multi-scale discriminator module.
  
  Args:
      scales (int): Number of multi-scales.
      downsample_pooling (str): Pooling module name for downsampling of the
          inputs.
      downsample_pooling_params (Dict[str, Any]): Parameters for the above pooling
          module.
      discriminator_params (Dict[str, Any]): Parameters for hifi-gan scale
          discriminator module.
      follow_official_norm (bool): Whether to follow the norm setting of the
          official implementaion. The first discriminator uses spectral norm
          and the other discriminators use weight norm.
docstr_tok: ["Initilize","HiFiGAN","multi-scale","discriminator","module",".","Args",":","scales","(","int",")",":","Number","of","multi-scales",".","downsample_pooling","(","str",")",":","Pooling","module","name","for","downsampling","of","the","inputs",".","downsample_pooling_params","(","Dict","[","str",",","Any","]",")",":","Parameters","for","the","above","pooling","module",".","discriminator_params","(","Dict","[","str",",","Any","]",")",":","Parameters","for","hifi-gan","scale","discriminator","module",".","follow_official_norm","(","bool",")",":","Whether","to","follow","the","norm","setting","of","the","official","implementaion",".","The","first","discriminator","uses","spectral","norm","and","the","other","discriminators","use","weight","norm","."]
code: def __init__(
      self,
      scales: int = 3,
      downsample_pooling: str = "AvgPool1d",
      # follow the official implementation setting
      downsample_pooling_params: Dict[str, Any] = {
          "kernel_size": 4,
          "stride": 2,
          "padding": 2,
      },
      discriminator_params: Dict[str, Any] = {
          "in_channels": 1,
          "out_channels": 1,
          "kernel_sizes": [15, 41, 5, 3],
          "channels": 128,
          "max_downsample_channels": 1024,
          "max_groups": 16,
          "bias": True,
          "downsample_scales": [2, 2, 4, 4, 1],
          "nonlinear_activation": "LeakyReLU",
          "nonlinear_activation_params": {"negative_slope": 0.1},
      },
      follow_official_norm: bool = False,
  ):
      """Initilize HiFiGAN multi-scale discriminator module.
  
      Args:
          scales (int): Number of multi-scales.
          downsample_pooling (str): Pooling module name for downsampling of the
              inputs.
          downsample_pooling_params (Dict[str, Any]): Parameters for the above pooling
              module.
          discriminator_params (Dict[str, Any]): Parameters for hifi-gan scale
              discriminator module.
          follow_official_norm (bool): Whether to follow the norm setting of the
              official implementaion. The first discriminator uses spectral norm
              and the other discriminators use weight norm.
  
      """
      super().__init__()
      self.discriminators = torch.nn.ModuleList()
  
      # add discriminators
      for i in range(scales):
          params = copy.deepcopy(discriminator_params)
          if follow_official_norm:
              if i == 0:
                  params["use_weight_norm"] = False
                  params["use_spectral_norm"] = True
              else:
                  params["use_weight_norm"] = True
                  params["use_spectral_norm"] = False
          self.discriminators += [HiFiGANScaleDiscriminator(**params)]
      self.pooling = None
      if scales > 1:
          self.pooling = getattr(torch.nn, downsample_pooling)(
              **downsample_pooling_params
          )
  
imports: import copy
  import logging
  from typing import Any, Dict, List, Optional
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_tts.hifigan.residual_block import ResidualBlock
label_desc: Use image node_id 1 to create a new HiFiGANMultiScaleDiscriminator object from inherited base classes: torch.nn with example: obj = HiFiGANMultiScaleDiscriminator(scales, downsample_pooling, downsample_pooling_params, discriminator_params, follow_official_norm)