class_docstr: Period sub-discriminator.
  
  Args:
      period (int): Period between samples of audio.
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      n_layers (int): Number of convolutional layers.
      kernel_sizes (list of int): Kernel sizes for convolutions.
      stride (int): Stride for convolutions.
      filters (int): Initial number of filters in convolutions.
      filters_scale (int): Multiplier of number of filters as we increase depth.
      max_filters (int): Maximum number of filters.
      norm (str): Normalization method.
      activation (str): Activation function.
      activation_params (dict): Parameters to provide to the activation function.
class_docstr_tok: ["Period","sub-discriminator",".","Args",":","period","(","int",")",":","Period","between","samples","of","audio",".","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","n_layers","(","int",")",":","Number","of","convolutional","layers",".","kernel_sizes","(","list","of","int",")",":","Kernel","sizes","for","convolutions",".","stride","(","int",")",":","Stride","for","convolutions",".","filters","(","int",")",":","Initial","number","of","filters","in","convolutions",".","filters_scale","(","int",")",":","Multiplier","of","number","of","filters","as","we","increase","depth",".","max_filters","(","int",")",":","Maximum","number","of","filters",".","norm","(","str",")",":","Normalization","method",".","activation","(","str",")",":","Activation","function",".","activation_params","(","dict",")",":","Parameters","to","provide","to","the","activation","function","."]
code: def __init__(
      self,
      period: int,
      in_channels: int = 1,
      out_channels: int = 1,
      n_layers: int = 5,
      kernel_sizes: tp.List[int] = [5, 3],
      stride: int = 3,
      filters: int = 8,
      filters_scale: int = 4,
      max_filters: int = 1024,
      norm: str = "weight_norm",
      activation: str = "LeakyReLU",
      activation_params: dict = {"negative_slope": 0.2},
  ):
      super().__init__()
      self.period = period
      self.n_layers = n_layers
      self.activation = getattr(torch.nn, activation)(
          **activation_params
      )
      self.convs = nn.ModuleList()
      in_chs = in_channels
      for i in range(self.n_layers):
          out_chs = min(
              filters * (filters_scale ** (i + 1)), max_filters
          )
          eff_stride = 1 if i == self.n_layers - 1 else stride
          self.convs.append(
              NormConv2d(
                  in_chs,
                  out_chs,
                  kernel_size=(kernel_sizes[0], 1),
                  stride=(eff_stride, 1),
                  padding=((kernel_sizes[0] - 1) // 2, 0),
                  norm=norm,
              )
          )
          in_chs = out_chs
      self.conv_post = NormConv2d(
          in_chs,
          out_channels,
          kernel_size=(kernel_sizes[1], 1),
          stride=1,
          padding=((kernel_sizes[1] - 1) // 2, 0),
          norm=norm,
      )
  
file_path: audiocraft/audiocraft/adversarial/discriminators/mpd.py
imports: import typing
  import torch
  import torch.nn
  import torch.nn.functional
  from ...modules import NormConv2d
  from .base import MultiDiscriminator, MultiDiscriminatorOutputType
label_desc: Use image node_id 1 to create a new PeriodDiscriminator object from inherited base classes: nn with example: obj = PeriodDiscriminator(period, in_channels, out_channels, n_layers, kernel_sizes, stride, filters, filters_scale, max_filters, norm, activation, activation_params)