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 forward(self, x):
      assert x.shape[1] == self.channels
      if self.use_conv_transpose:
          return self.conv(x)
  
      x = F.interpolate(x, scale_factor=2.0, mode="nearest")
  
      # TODO(Suraj, Patrick) - clean up after weight dicts are correctly renamed
      if self.use_conv:
          if self.name == "conv":
              x = self.conv(x)
          else:
              x = self.Conv2d_0(x)
  
      return x
  
imports: from functools import partial
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling the Upsample2D obj's underlying member method code with example usage: obj.forward(x) and returns: x, self