class_docstr: A downsampling layer with an optional convolution.
  
  Arguments
  ---------
  channels: int
      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
      downsampling occurs in the inner-two dimensions.
  
  Example
  -------
  >>> ups = Downsample(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, 16, 16])
class_docstr_tok: ["A","downsampling","layer","with","an","optional","convolution",".","Arguments","--","--","--","--","-","channels",":","int","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","downsampling","occurs","in","the","inner-two","dimensions",".","Example","--","--","--","-",">",">",">","ups","=","Downsample","(","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",",","16",",","16","]",")"]
docstr: Computes the downsampling pass
  
  Arguments
  ---------
  x: torch.Tensor
      layer inputs
  
  Returns
  -------
  result: torch.Tensor
      downsampled outputs
docstr_tok: ["Computes","the","downsampling","pass","Arguments","--","--","--","--","-","x",":","torch.Tensor","layer","inputs","Returns","--","--","--","-","result",":","torch.Tensor","downsampled","outputs"]
code: def forward(self, x):
      """Computes the downsampling pass
  
      Arguments
      ---------
      x: torch.Tensor
          layer inputs
  
      Returns
      -------
      result: torch.Tensor
          downsampled outputs
      """
      assert x.shape[1] == self.channels
      return self.op(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 Downsample obj's underlying member method code with example usage: obj.forward(x) and returns: self