class_docstr: Upsampling network module.
class_docstr_tok: ["Upsampling","network","module","."]
docstr: Initialize UpsampleNetwork module.
  
  Args:
      upsample_scales (List[int]): List of upsampling scales.
      nonlinear_activation (Optional[str]): Activation function name.
      nonlinear_activation_params (Dict[str, Any]): Arguments for the specified
          activation function.
      interpolate_mode (str): Interpolation mode.
      freq_axis_kernel_size (int): Kernel size in the direction of frequency axis.
docstr_tok: ["Initialize","UpsampleNetwork","module",".","Args",":","upsample_scales","(","List","[","int","]",")",":","List","of","upsampling","scales",".","nonlinear_activation","(","Optional","[","str","]",")",":","Activation","function","name",".","nonlinear_activation_params","(","Dict","[","str",",","Any","]",")",":","Arguments","for","the","specified","activation","function",".","interpolate_mode","(","str",")",":","Interpolation","mode",".","freq_axis_kernel_size","(","int",")",":","Kernel","size","in","the","direction","of","frequency","axis","."]
code: def __init__(
      self,
      upsample_scales: List[int],
      nonlinear_activation: Optional[str] = None,
      nonlinear_activation_params: Dict[str, Any] = {},
      interpolate_mode: str = "nearest",
      freq_axis_kernel_size: int = 1,
  ):
      """Initialize UpsampleNetwork module.
  
      Args:
          upsample_scales (List[int]): List of upsampling scales.
          nonlinear_activation (Optional[str]): Activation function name.
          nonlinear_activation_params (Dict[str, Any]): Arguments for the specified
              activation function.
          interpolate_mode (str): Interpolation mode.
          freq_axis_kernel_size (int): Kernel size in the direction of frequency axis.
  
      """
      super().__init__()
      self.up_layers = torch.nn.ModuleList()
      for scale in upsample_scales:
          # 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)
          padding = (freq_axis_padding, scale)
          conv = 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]
  
imports: from typing import Any, Dict, List, Optional
  import numpy
  import torch
  import torch.nn.functional
  from espnet2.gan_tts.wavenet.residual_block import Conv1d
label_desc: Use image node_id 1 to create a new UpsampleNetwork object from inherited base classes: torch.nn with example: obj = UpsampleNetwork(upsample_scales, nonlinear_activation, nonlinear_activation_params, interpolate_mode, freq_axis_kernel_size)