class_docstr: MelGAN multi-scale discriminator module.
docstr: Initilize MelGANMultiScaleDiscriminator module.
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      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.
      kernel_sizes (List[int]): List of two kernel sizes. The sum will be used
          for the first conv layer, and the first and the second kernel sizes
          will be used for the last two layers.
      channels (int): Initial number of channels for conv layer.
      max_downsample_channels (int): Maximum number of channels for downsampling
          layers.
      bias (bool): Whether to add bias parameter in convolution layers.
      downsample_scales (List[int]): List of downsampling scales.
      nonlinear_activation (str): Activation function module name.
      nonlinear_activation_params (Dict[str, Any]): Hyperparameters for activation
          function.
      pad (str): Padding function module name before dilated convolution layer.
      pad_params (Dict[str, Any]): Hyperparameters for padding function.
      use_weight_norm (bool): Whether to use weight norm.
docstr_tok: ["Initilize","MelGANMultiScaleDiscriminator","module",".","Args",":","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","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",".","kernel_sizes","(","List","[","int","]",")",":","List","of","two","kernel","sizes",".","The","sum","will","be","used","for","the","first","conv","layer",",","and","the","first","and","the","second","kernel","sizes","will","be","used","for","the","last","two","layers",".","channels","(","int",")",":","Initial","number","of","channels","for","conv","layer",".","max_downsample_channels","(","int",")",":","Maximum","number","of","channels","for","downsampling","layers",".","bias","(","bool",")",":","Whether","to","add","bias","parameter","in","convolution","layers",".","downsample_scales","(","List","[","int","]",")",":","List","of","downsampling","scales",".","nonlinear_activation","(","str",")",":","Activation","function","module","name",".","nonlinear_activation_params","(","Dict","[","str",",","Any","]",")",":","Hyperparameters","for","activation","function",".","pad","(","str",")",":","Padding","function","module","name","before","dilated","convolution","layer",".","pad_params","(","Dict","[","str",",","Any","]",")",":","Hyperparameters","for","padding","function",".","use_weight_norm","(","bool",")",":","Whether","to","use","weight","norm","."]
code: def __init__(
      self,
      in_channels: int = 1,
      out_channels: int = 1,
      scales: int = 3,
      downsample_pooling: str = "AvgPool1d",
      # follow the official implementation setting
      downsample_pooling_params: Dict[str, Any] = {
          "kernel_size": 4,
          "stride": 2,
          "padding": 1,
          "count_include_pad": False,
      },
      kernel_sizes: List[int] = [5, 3],
      channels: int = 16,
      max_downsample_channels: int = 1024,
      bias: bool = True,
      downsample_scales: List[int] = [4, 4, 4, 4],
      nonlinear_activation: str = "LeakyReLU",
      nonlinear_activation_params: Dict[str, Any] = {
          "negative_slope": 0.2
      },
      pad: str = "ReflectionPad1d",
      pad_params: Dict[str, Any] = {},
      use_weight_norm: bool = True,
  ):
      """Initilize MelGANMultiScaleDiscriminator module.
  
      Args:
          in_channels (int): Number of input channels.
          out_channels (int): Number of output channels.
          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.
          kernel_sizes (List[int]): List of two kernel sizes. The sum will be used
              for the first conv layer, and the first and the second kernel sizes
              will be used for the last two layers.
          channels (int): Initial number of channels for conv layer.
          max_downsample_channels (int): Maximum number of channels for downsampling
              layers.
          bias (bool): Whether to add bias parameter in convolution layers.
          downsample_scales (List[int]): List of downsampling scales.
          nonlinear_activation (str): Activation function module name.
          nonlinear_activation_params (Dict[str, Any]): Hyperparameters for activation
              function.
          pad (str): Padding function module name before dilated convolution layer.
          pad_params (Dict[str, Any]): Hyperparameters for padding function.
          use_weight_norm (bool): Whether to use weight norm.
  
      """
      super().__init__()
      self.discriminators = torch.nn.ModuleList()
  
      # add discriminators
      for _ in range(scales):
          self.discriminators += [
              MelGANDiscriminator(
                  in_channels=in_channels,
                  out_channels=out_channels,
                  kernel_sizes=kernel_sizes,
                  channels=channels,
                  max_downsample_channels=max_downsample_channels,
                  bias=bias,
                  downsample_scales=downsample_scales,
                  nonlinear_activation=nonlinear_activation,
                  nonlinear_activation_params=nonlinear_activation_params,
                  pad=pad,
                  pad_params=pad_params,
              )
          ]
      self.pooling = getattr(torch.nn, downsample_pooling)(
          **downsample_pooling_params
      )
  
      # apply weight norm
      if use_weight_norm:
          self.apply_weight_norm()
  
      # reset parameters
      self.reset_parameters()
  
imports: import logging
  from typing import Any, Dict, List
  import numpy
  import torch
  from espnet2.gan_tts.melgan.residual_stack import ResidualStack
label_desc: Use image node_id 1 to create a new MelGANMultiScaleDiscriminator object from inherited base classes: torch.nn with example: obj = MelGANMultiScaleDiscriminator(in_channels, out_channels, scales, downsample_pooling, downsample_pooling_params, kernel_sizes, channels, max_downsample_channels, bias, downsample_scales, nonlinear_activation, nonlinear_activation_params, pad, pad_params, use_weight_norm)