class_docstr: A 1-dimensional convolutional layer with optional weight normalization.
  
  This layer wraps a 1D convolutional layer from PyTorch and applies
  optional weight normalization. The layer can be used in a similar way to
  the convolutional layers in PyTorch's `torch.nn` module.
  
  Args:
      in_channels (int): The number of channels in the input signal.
      out_channels (int): The number of channels in the output signal.
      kernel_size (int, optional): The size of the convolving kernel.
          Defaults to 1.
      stride (int, optional): The stride of the convolution. Defaults to 1.
      padding (int, optional): Zero-padding added to both sides of the input.
          If `None`, the padding will be calculated so that the output has
          the same length as the input. Defaults to `None`.
      dilation (int, optional): Spacing between kernel elements. Defaults to 1.
      bias (bool, optional): If `True`, add bias after convolution. Defaults to `True`.
      w_init_gain (str, optional): The weight initialization function to use.
          Can be either 'linear' or 'relu'. Defaults to 'linear'.
      use_weight_norm (bool, optional): If `True`, apply weight normalization
          to the convolutional weights. Defaults to `False`.
  
  Shapes:
   - Input: :math:`[N, D, T]`
  
  - Output: :math:`[N, out_dim, T]` where `out_dim` is the number of output dimensions.
class_docstr_tok: ["A","1-dimensional","convolutional","layer","with","optional","weight","normalization",".","This","layer","wraps","a","1D","convolutional","layer","from","PyTorch","and","applies","optional","weight","normalization",".","The","layer","can","be","used","in","a","similar","way","to","the","convolutional","layers","in","PyTorch","'s","`","torch.nn","`","module",".","Args",":","in_channels","(","int",")",":","The","number","of","channels","in","the","input","signal",".","out_channels","(","int",")",":","The","number","of","channels","in","the","output","signal",".","kernel_size","(","int",",","optional",")",":","The","size","of","the","convolving","kernel",".","Defaults","to","1.","stride","(","int",",","optional",")",":","The","stride","of","the","convolution",".","Defaults","to","1.","padding","(","int",",","optional",")",":","Zero-padding","added","to","both","sides","of","the","input",".","If","`","None","`",",","the","padding","will","be","calculated","so","that","the","output","has","the","same","length","as","the","input",".","Defaults","to","`","None","`",".","dilation","(","int",",","optional",")",":","Spacing","between","kernel","elements",".","Defaults","to","1.","bias","(","bool",",","optional",")",":","If","`","True","`",",","add","bias","after","convolution",".","Defaults","to","`","True","`",".","w_init_gain","(","str",",","optional",")",":","The","weight","initialization","function","to","use",".","Can","be","either","'linear","'","or","'relu","'",".","Defaults","to","'linear","'",".","use_weight_norm","(","bool",",","optional",")",":","If","`","True","`",",","apply","weight","normalization","to","the","convolutional","weights",".","Defaults","to","`","False","`",".","Shapes",":","-","Input",":",":","math",":","`","[","N",",","D",",","T","]","`","-","Output",":",":","math",":","`","[","N",",","out_dim",",","T","]","`","where","`","out_dim","`","is","the","number","of","output","dimensions","."]
code: def __init__(
      self,
      in_channels,
      out_channels,
      kernel_size=1,
      stride=1,
      padding=None,
      dilation=1,
      bias=True,
      w_init_gain="linear",
      use_weight_norm=False,
  ):
      super(
          ConvNorm, self
      ).__init__()  # pylint: disable=super-with-arguments
      if padding is None:
          assert kernel_size % 2 == 1
          padding = int(dilation * (kernel_size - 1) / 2)
      self.kernel_size = kernel_size
      self.dilation = dilation
      self.use_weight_norm = use_weight_norm
      conv_fn = nn.Conv1d
      self.conv = conv_fn(
          in_channels,
          out_channels,
          kernel_size=kernel_size,
          stride=stride,
          padding=padding,
          dilation=dilation,
          bias=bias,
      )
      nn.init.xavier_uniform_(
          self.conv.weight, gain=nn.init.calculate_gain(w_init_gain)
      )
      if self.use_weight_norm:
          self.conv = nn.utils.parametrizations.weight_norm(self.conv)
  
imports: from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.utils import parametrize
  from TTS.tts.layers.delightful_tts.kernel_predictor import KernelPredictor
label_desc: Use image node_id 1 to create a new ConvNorm object from inherited base classes: nn with example: obj = ConvNorm(in_channels, out_channels, kernel_size, stride, padding, dilation, bias, w_init_gain, use_weight_norm)