class_docstr: An upsampling layer with an optional convolution.
  
  Arguments
  ---------
  channels: torch.Tensor
      channels in the inputs and outputs.
  use_conv: bool
      a bool determining if a convolution is applied.
  dims: int
      determines if the signal is 1D, 2D, or 3D. If 3D, then
      upsampling occurs in the inner-two dimensions.
  
  Example
  -------
  >>> ups = Upsample(channels=4, use_conv=True, dims=2, out_channels=8)
  >>> x = torch.randn(8, 4, 32, 32)
  >>> x_up = ups(x)
  >>> x_up.shape
  torch.Size([8, 8, 64, 64])
class_docstr_tok: ["An","upsampling","layer","with","an","optional","convolution",".","Arguments","--","--","--","--","-","channels",":","torch.Tensor","channels","in","the","inputs","and","outputs",".","use_conv",":","bool","a","bool","determining","if","a","convolution","is","applied",".","dims",":","int","determines","if","the","signal","is","1D",",","2D",",","or","3D",".","If","3D",",","then","upsampling","occurs","in","the","inner-two","dimensions",".","Example","--","--","--","-",">",">",">","ups","=","Upsample","(","channels=4",",","use_conv=True",",","dims=2",",","out_channels=8",")",">",">",">","x","=","torch.randn","(","8",",","4",",","32",",","32",")",">",">",">","x_up","=","ups","(","x",")",">",">",">","x_up.shape","torch.Size","(","[","8",",","8",",","64",",","64","]",")"]
docstr: Computes the upsampling pass
  
  Arguments
  ---------
  x: torch.Tensor
      layer inputs
  
  Results
  -------
  result: torch.Tensor
      upsampled outputs
docstr_tok: ["Computes","the","upsampling","pass","Arguments","--","--","--","--","-","x",":","torch.Tensor","layer","inputs","Results","--","--","--","-","result",":","torch.Tensor","upsampled","outputs"]
code: def forward(self, x):
      """Computes the upsampling pass
  
      Arguments
      ---------
      x: torch.Tensor
          layer inputs
  
      Results
      -------
      result: torch.Tensor
          upsampled outputs"""
      assert x.shape[1] == self.channels
      if self.dims == 3:
          x = F.interpolate(
              x,
              (x.shape[2], x.shape[3] * 2, x.shape[4] * 2),
              mode="nearest",
          )
      else:
          x = F.interpolate(x, scale_factor=2, mode="nearest")
      if self.use_conv:
          x = self.conv(x)
      return x
  
imports: from abc import abstractmethod
  from speechbrain.utils.data_utils import pad_divisible
  from .autoencoders import NormalizingAutoencoder
  import math
  import torch
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the Upsample obj's underlying member method code with example usage: obj.forward(x) and returns: x