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, dims=2, out_channels=None, padding=1
  ):
      super().__init__()
      self.channels = channels
      self.out_channels = out_channels or channels
      self.use_conv = use_conv
      self.dims = dims
      if use_conv:
          self.conv = conv_nd(
              dims, self.channels, self.out_channels, 3, padding=padding
          )
  
imports: from abc import abstractmethod
  from functools import partial
  import math
  from typing import Iterable
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from ldm.modules.diffusionmodules.util import checkpoint, conv_nd, linear, avg_pool_nd, zero_module, normalization, timestep_embedding
  from ldm.modules.attention import SpatialTransformer
label_desc: Use image node_id 1 to create a new Upsample object from inherited base classes: nn with example: obj = Upsample(channels, use_conv, dims, out_channels, padding)