docstr: Univnet Generator network.
  
  Paper: https://arxiv.org/pdf/2106.07889.pdf
  
  Args:
      in_channels (int): Number of input tensor channels.
      out_channels (int): Number of channels of the output tensor.
      hidden_channels (int): Number of hidden network channels.
      cond_channels (int): Number of channels of the conditioning tensors.
      upsample_factors (List[int]): List of uplsample factors for the upsampling layers.
      lvc_layers_each_block (int): Number of LVC layers in each block.
      lvc_kernel_size (int): Kernel size of the LVC layers.
      kpnet_hidden_channels (int): Number of hidden channels in the key-point network.
      kpnet_conv_size (int): Number of convolution channels in the key-point network.
      dropout (float): Dropout rate.
      use_weight_norm (bool, optional): Enable/disable weight norm. Defaults to True.
docstr_tok: ["Univnet","Generator","network",".","Paper",":","https",":","\/\/arxiv.org\/pdf\/2106.07889.pdf","Args",":","in_channels","(","int",")",":","Number","of","input","tensor","channels",".","out_channels","(","int",")",":","Number","of","channels","of","the","output","tensor",".","hidden_channels","(","int",")",":","Number","of","hidden","network","channels",".","cond_channels","(","int",")",":","Number","of","channels","of","the","conditioning","tensors",".","upsample_factors","(","List","[","int","]",")",":","List","of","uplsample","factors","for","the","upsampling","layers",".","lvc_layers_each_block","(","int",")",":","Number","of","LVC","layers","in","each","block",".","lvc_kernel_size","(","int",")",":","Kernel","size","of","the","LVC","layers",".","kpnet_hidden_channels","(","int",")",":","Number","of","hidden","channels","in","the","key-point","network",".","kpnet_conv_size","(","int",")",":","Number","of","convolution","channels","in","the","key-point","network",".","dropout","(","float",")",":","Dropout","rate",".","use_weight_norm","(","bool",",","optional",")",":","Enable\/disable","weight","norm",".","Defaults","to","True","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      hidden_channels: int,
      cond_channels: int,
      upsample_factors: List[int],
      lvc_layers_each_block: int,
      lvc_kernel_size: int,
      kpnet_hidden_channels: int,
      kpnet_conv_size: int,
      dropout: float,
      use_weight_norm=True,
  ):
      """Univnet Generator network.
  
      Paper: https://arxiv.org/pdf/2106.07889.pdf
  
      Args:
          in_channels (int): Number of input tensor channels.
          out_channels (int): Number of channels of the output tensor.
          hidden_channels (int): Number of hidden network channels.
          cond_channels (int): Number of channels of the conditioning tensors.
          upsample_factors (List[int]): List of uplsample factors for the upsampling layers.
          lvc_layers_each_block (int): Number of LVC layers in each block.
          lvc_kernel_size (int): Kernel size of the LVC layers.
          kpnet_hidden_channels (int): Number of hidden channels in the key-point network.
          kpnet_conv_size (int): Number of convolution channels in the key-point network.
          dropout (float): Dropout rate.
          use_weight_norm (bool, optional): Enable/disable weight norm. Defaults to True.
      """
  
      super().__init__()
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.cond_channels = cond_channels
      self.upsample_scale = np.prod(upsample_factors)
      self.lvc_block_nums = len(upsample_factors)
  
      # define first convolution
      self.first_conv = torch.nn.Conv1d(
          in_channels,
          hidden_channels,
          kernel_size=7,
          padding=(7 - 1) // 2,
          dilation=1,
          bias=True,
      )
  
      # define residual blocks
      self.lvc_blocks = torch.nn.ModuleList()
      cond_hop_length = 1
      for n in range(self.lvc_block_nums):
          cond_hop_length = cond_hop_length * upsample_factors[n]
          lvcb = LVCBlock(
              in_channels=hidden_channels,
              cond_channels=cond_channels,
              upsample_ratio=upsample_factors[n],
              conv_layers=lvc_layers_each_block,
              conv_kernel_size=lvc_kernel_size,
              cond_hop_length=cond_hop_length,
              kpnet_hidden_channels=kpnet_hidden_channels,
              kpnet_conv_size=kpnet_conv_size,
              kpnet_dropout=dropout,
          )
          self.lvc_blocks += [lvcb]
  
      # define output layers
      self.last_conv_layers = torch.nn.ModuleList(
          [
              torch.nn.Conv1d(
                  hidden_channels,
                  out_channels,
                  kernel_size=7,
                  padding=(7 - 1) // 2,
                  dilation=1,
                  bias=True,
              ),
          ]
      )
  
      # apply weight norm
      if use_weight_norm:
          self.apply_weight_norm()
  
file_path: TTS/TTS/vocoder/models/univnet_generator.py
imports: from typing import List
  import numpy
  import torch
  import torch.nn.functional
  from torch.nn.utils import parametrize
  from TTS.vocoder.layers.lvc_block import LVCBlock
label_desc: Use image node_id 1 to create a new UnivnetGenerator object from inherited base classes: torch.nn with example: obj = UnivnetGenerator(in_channels, out_channels, hidden_channels, cond_channels, upsample_factors, lvc_layers_each_block, lvc_kernel_size, kpnet_hidden_channels, kpnet_conv_size, dropout, use_weight_norm)