class_docstr: A wrapper module that applies the necessary padding for
  the downsampling factor
  
  Arguments
  ---------
  factor: int
      the downsampling / divisibility factor
  len_dim: int
      the index of the dimension in which the length will vary
  dims: list
      the list of dimensions to be included in padding
  
  Example
  -------
  >>> padding = DownsamplingPadding(factor=4, dims=[1, 2], len_dim=1)
  >>> x = torch.randn(4, 7, 14)
  >>> length = torch.tensor([1., 0.8, 1., 0.7])
  >>> x, length_new = padding(x, length)
  >>> x.shape
  torch.Size([4, 8, 16])
  >>> length_new
  tensor([0.8750, 0.7000, 0.8750, 0.6125])
class_docstr_tok: ["A","wrapper","module","that","applies","the","necessary","padding","for","the","downsampling","factor","Arguments","--","--","--","--","-","factor",":","int","the","downsampling","\/","divisibility","factor","len_dim",":","int","the","index","of","the","dimension","in","which","the","length","will","vary","dims",":","list","the","list","of","dimensions","to","be","included","in","padding","Example","--","--","--","-",">",">",">","padding","=","DownsamplingPadding","(","factor=4",",","dims=","[","1",",","2","]",",","len_dim=1",")",">",">",">","x","=","torch.randn","(","4",",","7",",","14",")",">",">",">","length","=","torch.tensor","(","[","1.",",","0.8",",","1.",",","0.7","]",")",">",">",">","x",",","length_new","=","padding","(","x",",","length",")",">",">",">","x.shape","torch.Size","(","[","4",",","8",",","16","]",")",">",">",">","length_new","tensor","(","[","0.8750",",","0.7000",",","0.8750",",","0.6125","]",")"]
docstr: Applies the padding
  
  Arguments
  ---------
  x: torch.Tensor
      the sample
  length: torch.Tensor
      the length tensor
  
  Returns
  -------
  x_pad: torch.Tensor
      the padded tensor
  lens: torch.Tensor
      the new, adjusted lengths, if applicable
docstr_tok: ["Applies","the","padding","Arguments","--","--","--","--","-","x",":","torch.Tensor","the","sample","length",":","torch.Tensor","the","length","tensor","Returns","--","--","--","-","x_pad",":","torch.Tensor","the","padded","tensor","lens",":","torch.Tensor","the","new",",","adjusted","lengths",",","if","applicable"]
code: def forward(self, x, length=None):
      """Applies the padding
  
      Arguments
      ---------
      x: torch.Tensor
          the sample
      length: torch.Tensor
          the length tensor
  
      Returns
      -------
      x_pad: torch.Tensor
          the padded tensor
      lens: torch.Tensor
          the new, adjusted lengths, if applicable
      """
      updated_length = length
      for dim in self.dims:
          # TODO: Consider expanding pad_divisible to support multiple dimensions
          x, length_pad = pad_divisible(
              x, length, self.factor, len_dim=dim
          )
          if dim == self.len_dim:
              updated_length = length_pad
      return x, updated_length
  
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 DownsamplingPadding obj's underlying member method code with example usage: obj.forward(x, length) and returns: x,  updated_length