code: def __init__(
      self,
      upsample_factors,
      nonlinear_activation=None,
      nonlinear_activation_params={},
      interpolate_mode="nearest",
      freq_axis_kernel_size=1,
      use_causal_conv=False,
  ):
      super(UpsampleNetwork, self).__init__()
      self.use_causal_conv = use_causal_conv
      self.up_layers = torch.nn.ModuleList()
      for scale in upsample_factors:
          # interpolation layer
          stretch = Stretch2d(scale, 1, interpolate_mode)
          self.up_layers += [stretch]
  
          # conv layer
          assert (
              freq_axis_kernel_size - 1
          ) % 2 == 0, "Not support even number freq axis kernel size."
          freq_axis_padding = (freq_axis_kernel_size - 1) // 2
          kernel_size = (freq_axis_kernel_size, scale * 2 + 1)
          if use_causal_conv:
              padding = (freq_axis_padding, scale * 2)
          else:
              padding = (freq_axis_padding, scale)
          conv = torch.nn.Conv2d(
              1, 1, kernel_size=kernel_size, padding=padding, bias=False
          )
          self.up_layers += [conv]
  
          # nonlinear
          if nonlinear_activation is not None:
              nonlinear = getattr(torch.nn, nonlinear_activation)(
                  **nonlinear_activation_params
              )
              self.up_layers += [nonlinear]
  
file_path: TTS/TTS/vocoder/layers/upsample.py
imports: import torch
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new UpsampleNetwork object from inherited base classes: torch.nn with example: obj = UpsampleNetwork(upsample_factors, nonlinear_activation, nonlinear_activation_params, interpolate_mode, freq_axis_kernel_size, use_causal_conv)