class_docstr: A base diffusion implementation
  
  Arguments
  ---------
  model: nn.Module
      the underlying model
  timesteps: int
      the number of timesteps
  noise: callable|str
      the noise function/module to use
  
      The following predefined types of noise are provided
      "gaussian": Gaussian noise, applied to the whole sample
      "length_masked_gaussian": Gaussian noise applied only
          to the parts of the sample that is not padding
docstr: Adds noise to a batch of data
  
  Arguments
  ---------
  x: torch.Tensor
      the original data sample
  timesteps: torch.Tensor
      a 1-D integer tensor of a length equal to the number of
      batches in x, where each entry corresponds to the timestep
      number for the batch. If omitted, timesteps will be randomly
      sampled
  
  Returns
  -------
  result: torch.Tensor
      a tensor of the same dimension as x
code: def distort(self, x, timesteps=None):
      """Adds noise to a batch of data
  
      Arguments
      ---------
      x: torch.Tensor
          the original data sample
      timesteps: torch.Tensor
          a 1-D integer tensor of a length equal to the number of
          batches in x, where each entry corresponds to the timestep
          number for the batch. If omitted, timesteps will be randomly
          sampled
  
      Returns
      -------
      result: torch.Tensor
          a tensor of the same dimension as x
      """
      raise NotImplementedError
  
imports: from collections import namedtuple
  import torch
  from torch import nn
  from torch.nn import functional
  from tqdm.auto import tqdm
  from speechbrain.utils.data_utils import unsqueeze_as
  from speechbrain.dataio.dataio import length_to_mask
  from speechbrain.utils import data_utils
label_desc: Use image node_id 2 for calling the Diffuser obj's underlying member method code with example usage: obj.distort(x, timesteps) without return types