class_docstr: STFT sub-discriminator.
  
  Args:
      filters (int): Number of filters in convolutions.
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      n_fft (int): Size of FFT for each scale.
      hop_length (int): Length of hop between STFT windows for each scale.
      kernel_size (tuple of int): Inner Conv2d kernel sizes.
      stride (tuple of int): Inner Conv2d strides.
      dilations (list of int): Inner Conv2d dilation on the time dimension.
      win_length (int): Window size for each scale.
      normalized (bool): Whether to normalize by magnitude after stft.
      norm (str): Normalization method.
      activation (str): Activation function.
      activation_params (dict): Parameters to provide to the activation function.
      growth (int): Growth factor for the filters.
class_docstr_tok: ["STFT","sub-discriminator",".","Args",":","filters","(","int",")",":","Number","of","filters","in","convolutions",".","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","n_fft","(","int",")",":","Size","of","FFT","for","each","scale",".","hop_length","(","int",")",":","Length","of","hop","between","STFT","windows","for","each","scale",".","kernel_size","(","tuple","of","int",")",":","Inner","Conv2d","kernel","sizes",".","stride","(","tuple","of","int",")",":","Inner","Conv2d","strides",".","dilations","(","list","of","int",")",":","Inner","Conv2d","dilation","on","the","time","dimension",".","win_length","(","int",")",":","Window","size","for","each","scale",".","normalized","(","bool",")",":","Whether","to","normalize","by","magnitude","after","stft",".","norm","(","str",")",":","Normalization","method",".","activation","(","str",")",":","Activation","function",".","activation_params","(","dict",")",":","Parameters","to","provide","to","the","activation","function",".","growth","(","int",")",":","Growth","factor","for","the","filters","."]
code: def __init__(
      self,
      filters: int,
      in_channels: int = 1,
      out_channels: int = 1,
      n_fft: int = 1024,
      hop_length: int = 256,
      win_length: int = 1024,
      max_filters: int = 1024,
      filters_scale: int = 1,
      kernel_size: tp.Tuple[int, int] = (3, 9),
      dilations: tp.List = [1, 2, 4],
      stride: tp.Tuple[int, int] = (1, 2),
      normalized: bool = True,
      norm: str = "weight_norm",
      activation: str = "LeakyReLU",
      activation_params: dict = {"negative_slope": 0.2},
  ):
      super().__init__()
      assert len(kernel_size) == 2
      assert len(stride) == 2
      self.filters = filters
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.n_fft = n_fft
      self.hop_length = hop_length
      self.win_length = win_length
      self.normalized = normalized
      self.activation = getattr(torch.nn, activation)(
          **activation_params
      )
      self.spec_transform = torchaudio.transforms.Spectrogram(
          n_fft=self.n_fft,
          hop_length=self.hop_length,
          win_length=self.win_length,
          window_fn=torch.hann_window,
          normalized=self.normalized,
          center=False,
          pad_mode=None,
          power=None,
      )
      spec_channels = 2 * self.in_channels
      self.convs = nn.ModuleList()
      self.convs.append(
          NormConv2d(
              spec_channels,
              self.filters,
              kernel_size=kernel_size,
              padding=get_2d_padding(kernel_size),
          )
      )
      in_chs = min(filters_scale * self.filters, max_filters)
      for i, dilation in enumerate(dilations):
          out_chs = min(
              (filters_scale ** (i + 1)) * self.filters, max_filters
          )
          self.convs.append(
              NormConv2d(
                  in_chs,
                  out_chs,
                  kernel_size=kernel_size,
                  stride=stride,
                  dilation=(dilation, 1),
                  padding=get_2d_padding(kernel_size, (dilation, 1)),
                  norm=norm,
              )
          )
          in_chs = out_chs
      out_chs = min(
          (filters_scale ** (len(dilations) + 1)) * self.filters,
          max_filters,
      )
      self.convs.append(
          NormConv2d(
              in_chs,
              out_chs,
              kernel_size=(kernel_size[0], kernel_size[0]),
              padding=get_2d_padding((kernel_size[0], kernel_size[0])),
              norm=norm,
          )
      )
      self.conv_post = NormConv2d(
          out_chs,
          self.out_channels,
          kernel_size=(kernel_size[0], kernel_size[0]),
          padding=get_2d_padding((kernel_size[0], kernel_size[0])),
          norm=norm,
      )
  
file_path: audiocraft/audiocraft/adversarial/discriminators/msstftd.py
imports: import typing
  import torchaudio
  import torch
  from torch import nn
  from einops import rearrange
  from ...modules import NormConv2d
  from .base import MultiDiscriminator, MultiDiscriminatorOutputType
label_desc: Use image node_id 1 to create a new DiscriminatorSTFT object from inherited base classes: nn with example: obj = DiscriminatorSTFT(filters, in_channels, out_channels, n_fft, hop_length, win_length, max_filters, filters_scale, kernel_size, dilations, stride, normalized, norm, activation, activation_params)