class_docstr: An upsampling layer with an optional convolution.
  
  :param channels: channels in the inputs and outputs. :param use_conv: a bool determining if a convolution is
  applied. :param dims: determines if the signal is 1D, 2D, or 3D. If 3D, then
               upsampling occurs in the inner-two dimensions.
class_docstr_tok: ["An","upsampling","layer","with","an","optional","convolution",".",":","param","channels",":","channels","in","the","inputs","and","outputs",".",":","param","use_conv",":","a","bool","determining","if","a","convolution","is","applied",".",":","param","dims",":","determines","if","the","signal","is","1D",",","2D",",","or","3D",".","If","3D",",","then","upsampling","occurs","in","the","inner-two","dimensions","."]
code: def __init__(
      self,
      channels,
      use_conv=False,
      use_conv_transpose=False,
      out_channels=None,
      name="conv",
  ):
      super().__init__()
      self.channels = channels
      self.out_channels = out_channels or channels
      self.use_conv = use_conv
      self.use_conv_transpose = use_conv_transpose
      self.name = name
  
      conv = None
      if use_conv_transpose:
          conv = nn.Conv2DTranspose(
              channels, self.out_channels, 4, 2, 1
          )
      elif use_conv:
          conv = nn.Conv2D(
              self.channels, self.out_channels, 3, padding=1
          )
  
      # TODO(Suraj, Patrick) - clean up after weight dicts are correctly renamed
      if name == "conv":
          self.conv = conv
      else:
          self.Conv2d_0 = conv
  
imports: from functools import partial
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new Upsample2D object from inherited base classes: nn with example: obj = Upsample2D(channels, use_conv, use_conv_transpose, out_channels, name)