class_docstr: GAN-based model to add details to blurry spectrograms from TTS models like Tacotron or FastPitch. Based on StyleGAN 2 [1]
  [1] Karras et. al. - Analyzing and Improving the Image Quality of StyleGAN (https://arxiv.org/abs/1912.04958)
class_docstr_tok: ["GAN-based","model","to","add","details","to","blurry","spectrograms","from","TTS","models","like","Tacotron","or","FastPitch",".","Based","on","StyleGAN","2","[","1","]","[","1","]","Karras","et",".","al",".","-","Analyzing","and","Improving","the","Image","Quality","of","StyleGAN","(","https",":","\/\/arxiv.org\/abs\/1912.04958",")"]
code: def pad_spectrograms(self, spectrograms):
      multiplier = self.generator.upsample_factor
      *_, max_length = spectrograms.shape
      return F.pad(
          spectrograms, (0, multiplier - max_length % multiplier)
      )
  
imports: from random import random, randrange
  from typing import List, Optional
  import torch
  import torch.nn.functional
  from einops import rearrange
  from hydra.utils import instantiate
  from omegaconf import DictConfig
  from pytorch_lightning import Trainer
  from pytorch_lightning.loggers import TensorBoardLogger, WandbLogger
  from torch.utils.tensorboard.writer import SummaryWriter
  from nemo.collections.tts.losses.spectrogram_enhancer_losses import ConsistencyLoss, GeneratorLoss, GradientPenaltyLoss, HingeLoss
  from nemo.collections.tts.parts.utils.helpers import mask_sequence_tensor, to_device_recursive
  from nemo.core import Exportable, ModelPT, PretrainedModelInfo, typecheck
  from nemo.core.neural_types import LengthsType, MelSpectrogramType, NeuralType
  from nemo.core.neural_types.elements import BoolType
  from nemo.utils import logging
label_desc: Use image node_id 7 for calling the SpectrogramEnhancerModel obj's underlying member method code with example usage: obj.pad_spectrograms(spectrograms) and returns: F