class_docstr: Kernel predictor for the location-variable convolutions
class_docstr_tok: ["Kernel","predictor","for","the","location-variable","convolutions"]
docstr: Args:
      cond_channels (int): number of channel for the conditioning sequence,
      conv_in_channels (int): number of channel for the input sequence,
      conv_out_channels (int): number of channel for the output sequence,
      conv_layers (int): number of layers
docstr_tok: ["Args",":","cond_channels","(","int",")",":","number","of","channel","for","the","conditioning","sequence",",","conv_in_channels","(","int",")",":","number","of","channel","for","the","input","sequence",",","conv_out_channels","(","int",")",":","number","of","channel","for","the","output","sequence",",","conv_layers","(","int",")",":","number","of","layers"]
code: def __init__(
      self,
      cond_channels,
      conv_in_channels,
      conv_out_channels,
      conv_layers,
      conv_kernel_size=3,
      kpnet_hidden_channels=64,
      kpnet_conv_size=3,
      kpnet_dropout=0.0,
      kpnet_nonlinear_activation="LeakyReLU",
      kpnet_nonlinear_activation_params={"negative_slope": 0.1},
  ):
      """
      Args:
          cond_channels (int): number of channel for the conditioning sequence,
          conv_in_channels (int): number of channel for the input sequence,
          conv_out_channels (int): number of channel for the output sequence,
          conv_layers (int): number of layers
      """
      super().__init__()
  
      self.conv_in_channels = conv_in_channels
      self.conv_out_channels = conv_out_channels
      self.conv_kernel_size = conv_kernel_size
      self.conv_layers = conv_layers
  
      kpnet_kernel_channels = (
          conv_in_channels
          * conv_out_channels
          * conv_kernel_size
          * conv_layers
      )  # l_w
      kpnet_bias_channels = conv_out_channels * conv_layers  # l_b
  
      self.input_conv = nn.Sequential(
          nn.utils.parametrizations.weight_norm(
              nn.Conv1d(
                  cond_channels,
                  kpnet_hidden_channels,
                  5,
                  padding=2,
                  bias=True,
              )
          ),
          getattr(nn, kpnet_nonlinear_activation)(
              **kpnet_nonlinear_activation_params
          ),
      )
  
      self.residual_convs = nn.ModuleList()
      padding = (kpnet_conv_size - 1) // 2
      for _ in range(3):
          self.residual_convs.append(
              nn.Sequential(
                  nn.Dropout(kpnet_dropout),
                  nn.utils.parametrizations.weight_norm(
                      nn.Conv1d(
                          kpnet_hidden_channels,
                          kpnet_hidden_channels,
                          kpnet_conv_size,
                          padding=padding,
                          bias=True,
                      )
                  ),
                  getattr(nn, kpnet_nonlinear_activation)(
                      **kpnet_nonlinear_activation_params
                  ),
                  nn.utils.parametrizations.weight_norm(
                      nn.Conv1d(
                          kpnet_hidden_channels,
                          kpnet_hidden_channels,
                          kpnet_conv_size,
                          padding=padding,
                          bias=True,
                      )
                  ),
                  getattr(nn, kpnet_nonlinear_activation)(
                      **kpnet_nonlinear_activation_params
                  ),
              )
          )
      self.kernel_conv = nn.utils.parametrizations.weight_norm(
          nn.Conv1d(
              kpnet_hidden_channels,
              kpnet_kernel_channels,
              kpnet_conv_size,
              padding=padding,
              bias=True,
          )
      )
      self.bias_conv = nn.utils.parametrizations.weight_norm(
          nn.Conv1d(
              kpnet_hidden_channels,
              kpnet_bias_channels,
              kpnet_conv_size,
              padding=padding,
              bias=True,
          )
      )
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Callable, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.nn.utils.parametrize
label_desc: Use image node_id 1 to create a new KernelPredictor object from inherited base classes: torch.nn with example: obj = KernelPredictor(cond_channels, conv_in_channels, conv_out_channels, conv_layers, conv_kernel_size, kpnet_hidden_channels, kpnet_conv_size, kpnet_dropout, kpnet_nonlinear_activation, kpnet_nonlinear_activation_params)