class_docstr: An implementation of a classic Denoising Diffusion Probabilistic Model (DDPM)
  
  Arguments
  ---------
  model: nn.Module
      the underlying model
  
  timesteps: int
      the number of timesteps
  
  noise: str|nn.Module
      the type of noise being used
      "gaussian" will produce standard Gaussian noise
  
  
  beta_start: float
      the value of the "beta" parameter at the beginning at the end of the process
      (see the paper)
  
  beta_end: float
      the value of the "beta" parameter at the end of the process
  
  show_progress: bool
      whether to show progress during inference
  
  Example
  -------
  >>> from speechbrain.nnet.unet import UNetModel
  >>> unet = UNetModel(
  ...     in_channels=1,
  ...     model_channels=16,
  ...     norm_num_groups=4,
  ...     out_channels=1,
  ...     num_res_blocks=1,
  ...     attention_resolutions=[]
  ... )
  >>> diff = DenoisingDiffusion(
  ...     model=unet,
  ...     timesteps=5
  ... )
  >>> x = torch.randn(4, 1, 64, 64)
  >>> pred, noise, noisy_sample = diff.train_sample(x)
  >>> pred.shape
  torch.Size([4, 1, 64, 64])
  >>> noise.shape
  torch.Size([4, 1, 64, 64])
  >>> noisy_sample.shape
  torch.Size([4, 1, 64, 64])
  >>> sample = diff.sample((2, 1, 64, 64))
  >>> sample.shape
  torch.Size([2, 1, 64, 64])
docstr: Processes a single timestep for the sampling
  process
  
  Arguments
  ---------
  sample: torch.Tensor
      the sample for the following timestep
  timestep: int
      the timestep number
  
  Arguments
  ---------
  predicted_sample: torch.Tensor
      the predicted sample (denoised by one step`)
code: def sample_step(self, sample, timestep, **kwargs):
      """Processes a single timestep for the sampling
      process
  
      Arguments
      ---------
      sample: torch.Tensor
          the sample for the following timestep
      timestep: int
          the timestep number
  
      Arguments
      ---------
      predicted_sample: torch.Tensor
          the predicted sample (denoised by one step`)
      """
      model_out = self.model(sample, timestep, **kwargs)
      noise = self.noise(sample)
      sample_start = (
          unsqueeze_as(
              self.sample_pred_model_coefficient[timestep], sample
          )
          * sample
          - unsqueeze_as(
              self.sample_pred_noise_coefficient[timestep], model_out
          )
          * model_out
      )
      weight_start = unsqueeze_as(
          self.posterior_mean_weight_start[timestep], sample_start
      )
      weight_step = unsqueeze_as(
          self.posterior_mean_weight_step[timestep], sample
      )
      mean = weight_start * sample_start + weight_step * sample
      log_variance = unsqueeze_as(
          self.posterior_log_variance[timestep], noise
      )
      predicted_sample = mean + (0.5 * log_variance).exp() * noise
      if self.sample_min is not None or self.sample_max is not None:
          predicted_sample.clip_(
              min=self.sample_min, max=self.sample_max
          )
      return predicted_sample
  
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 5 for calling the DenoisingDiffusion obj's underlying member method code with example usage: obj.sample_step(sample, timestep) and returns: predicted_sample