code: def __init__(self, cfg):
      super(Generator, self).__init__()
      self.num_kernels = len(cfg["resblock_kernel_sizes"])
      self.num_upsamples = len(cfg["upsample_rates"])
      self.conv_pre = weight_norm(
          Conv1d(
              cfg.get("model_in_dim", 80),
              cfg["upsample_initial_channel"],
              7,
              1,
              padding=3,
          )
      )
  
      self.ups = nn.ModuleList()
      for i, (u, k) in enumerate(
          zip(cfg["upsample_rates"], cfg["upsample_kernel_sizes"])
      ):
          self.ups.append(
              weight_norm(
                  ConvTranspose1d(
                      cfg["upsample_initial_channel"] // (2**i),
                      cfg["upsample_initial_channel"] // (2 ** (i + 1)),
                      k,
                      u,
                      padding=(k - u) // 2,
                  )
              )
          )
  
      self.resblocks = nn.ModuleList()
      for i in range(len(self.ups)):
          ch = cfg["upsample_initial_channel"] // (2 ** (i + 1))
          for k, d in zip(
              cfg["resblock_kernel_sizes"],
              cfg["resblock_dilation_sizes"],
          ):
              self.resblocks.append(ResBlock(ch, k, d))
  
      self.conv_post = weight_norm(Conv1d(ch, 1, 7, 1, padding=3))
      self.ups.apply(init_weights)
      self.conv_post.apply(init_weights)
  
file_path: fairseq/fairseq/models/text_to_speech/hifigan.py
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn import Conv1d, ConvTranspose1d
  from torch.nn.utils import remove_weight_norm, weight_norm
label_desc: Use image node_id 1 to create a new Generator object from inherited base classes: torch.nn with example: obj = Generator(cfg)