docstr: HiFiGAN Generator with Multi-Receptive Field Fusion (MRF)
  
  Network:
      x -> lrelu -> upsampling_layer -> resblock1_k1x1 -> z1 -> + -> z_sum / #resblocks -> lrelu -> conv_post_7x1 -> tanh -> o
                                           ..          -> zI ---|
                                        resblockN_kNx1 -> zN ---'
  
  Args:
      in_channels (int): number of input tensor channels.
      out_channels (int): number of output tensor channels.
      resblock_type (str): type of the `ResBlock`. '1' or '2'.
      resblock_dilation_sizes (List[List[int]]): list of dilation values in each layer of a `ResBlock`.
      resblock_kernel_sizes (List[int]): list of kernel sizes for each `ResBlock`.
      upsample_kernel_sizes (List[int]): list of kernel sizes for each transposed convolution.
      upsample_initial_channel (int): number of channels for the first upsampling layer. This is divided by 2
          for each consecutive upsampling layer.
      upsample_factors (List[int]): upsampling factors (stride) for each upsampling layer.
      inference_padding (int): constant padding applied to the input at inference time. Defaults to 5.
docstr_tok: ["HiFiGAN","Generator","with","Multi-Receptive","Field","Fusion","(","MRF",")","Network",":","x","-",">","lrelu","-",">","upsampling_layer","-",">","resblock1_k1x1","-",">","z1","-",">","+","-",">","z_sum","\/","#","resblocks","-",">","lrelu","-",">","conv_post_7x1","-",">","tanh","-",">","o","..","-",">","zI","--","-|","resblockN_kNx1","-",">","zN","--","-'","Args",":","in_channels","(","int",")",":","number","of","input","tensor","channels",".","out_channels","(","int",")",":","number","of","output","tensor","channels",".","resblock_type","(","str",")",":","type","of","the","`","ResBlock","`",".","'","1","'","or","'","2","'",".","resblock_dilation_sizes","(","List","[","List","[","int","]","]",")",":","list","of","dilation","values","in","each","layer","of","a","`","ResBlock","`",".","resblock_kernel_sizes","(","List","[","int","]",")",":","list","of","kernel","sizes","for","each","`","ResBlock","`",".","upsample_kernel_sizes","(","List","[","int","]",")",":","list","of","kernel","sizes","for","each","transposed","convolution",".","upsample_initial_channel","(","int",")",":","number","of","channels","for","the","first","upsampling","layer",".","This","is","divided","by","2","for","each","consecutive","upsampling","layer",".","upsample_factors","(","List","[","int","]",")",":","upsampling","factors","(","stride",")","for","each","upsampling","layer",".","inference_padding","(","int",")",":","constant","padding","applied","to","the","input","at","inference","time",".","Defaults","to","5","."]
code: def __init__(
      self,
      in_channels,
      out_channels,
      resblock_type,
      resblock_dilation_sizes,
      resblock_kernel_sizes,
      upsample_kernel_sizes,
      upsample_initial_channel,
      upsample_factors,
      inference_padding=5,
      cond_channels=0,
      conv_pre_weight_norm=True,
      conv_post_weight_norm=True,
      conv_post_bias=True,
      cond_in_each_up_layer=False,
  ):
      r"""HiFiGAN Generator with Multi-Receptive Field Fusion (MRF)
  
      Network:
          x -> lrelu -> upsampling_layer -> resblock1_k1x1 -> z1 -> + -> z_sum / #resblocks -> lrelu -> conv_post_7x1 -> tanh -> o
                                               ..          -> zI ---|
                                            resblockN_kNx1 -> zN ---'
  
      Args:
          in_channels (int): number of input tensor channels.
          out_channels (int): number of output tensor channels.
          resblock_type (str): type of the `ResBlock`. '1' or '2'.
          resblock_dilation_sizes (List[List[int]]): list of dilation values in each layer of a `ResBlock`.
          resblock_kernel_sizes (List[int]): list of kernel sizes for each `ResBlock`.
          upsample_kernel_sizes (List[int]): list of kernel sizes for each transposed convolution.
          upsample_initial_channel (int): number of channels for the first upsampling layer. This is divided by 2
              for each consecutive upsampling layer.
          upsample_factors (List[int]): upsampling factors (stride) for each upsampling layer.
          inference_padding (int): constant padding applied to the input at inference time. Defaults to 5.
      """
      super().__init__()
      self.inference_padding = inference_padding
      self.num_kernels = len(resblock_kernel_sizes)
      self.num_upsamples = len(upsample_factors)
      self.cond_in_each_up_layer = cond_in_each_up_layer
  
      # initial upsampling layers
      self.conv_pre = weight_norm(
          Conv1d(in_channels, upsample_initial_channel, 7, 1, padding=3)
      )
      resblock = ResBlock1 if resblock_type == "1" else ResBlock2
      # upsampling layers
      self.ups = nn.ModuleList()
      for i, (u, k) in enumerate(
          zip(upsample_factors, upsample_kernel_sizes)
      ):
          self.ups.append(
              weight_norm(
                  ConvTranspose1d(
                      upsample_initial_channel // (2**i),
                      upsample_initial_channel // (2 ** (i + 1)),
                      k,
                      u,
                      padding=(k - u) // 2,
                  )
              )
          )
      # MRF blocks
      self.resblocks = nn.ModuleList()
      for i in range(len(self.ups)):
          ch = upsample_initial_channel // (2 ** (i + 1))
          for _, (k, d) in enumerate(
              zip(resblock_kernel_sizes, resblock_dilation_sizes)
          ):
              self.resblocks.append(resblock(ch, k, d))
      # post convolution layer
      self.conv_post = weight_norm(
          Conv1d(ch, out_channels, 7, 1, padding=3, bias=conv_post_bias)
      )
      if cond_channels > 0:
          self.cond_layer = nn.Conv1d(
              cond_channels, upsample_initial_channel, 1
          )
  
      if not conv_pre_weight_norm:
          remove_parametrizations(self.conv_pre, "weight")
  
      if not conv_post_weight_norm:
          remove_parametrizations(self.conv_post, "weight")
  
      if self.cond_in_each_up_layer:
          self.conds = nn.ModuleList()
          for i in range(len(self.ups)):
              ch = upsample_initial_channel // (2 ** (i + 1))
              self.conds.append(nn.Conv1d(cond_channels, ch, 1))
  
imports: import torch
  import torchaudio
  from torch import nn
  from torch.nn import Conv1d, ConvTranspose1d
  from torch.nn import functional
  from torch.nn.utils.parametrizations import weight_norm
  from torch.nn.utils.parametrize import remove_parametrizations
  from TTS.utils.io import load_fsspec
label_desc: Use image node_id 1 to create a new HifiganGenerator object from inherited base classes: torch.nn with example: obj = HifiganGenerator(in_channels, out_channels, resblock_type, resblock_dilation_sizes, resblock_kernel_sizes, upsample_kernel_sizes, upsample_initial_channel, upsample_factors, inference_padding, cond_channels, conv_pre_weight_norm, conv_post_weight_norm, conv_post_bias, cond_in_each_up_layer)