class_docstr: A diffusion process which can skip steps in a base diffusion process.
  
  :param use_timesteps: a collection (sequence or set) of timesteps from the
                        original diffusion process to retain.
  :param kwargs: the kwargs to create the base diffusion process.
code: def __init__(self, use_timesteps, **kwargs):
      self.use_timesteps = set(use_timesteps)
      self.original_num_steps = len(kwargs["betas"])
  
      base_diffusion = GaussianDiffusion(
          **kwargs
      )  # pylint: disable=missing-kwoa
      last_alpha_cumprod = 1.0
      new_betas = []
      timestep_map = []
      for i, alpha_cumprod in enumerate(base_diffusion.alphas_cumprod):
          if i in self.use_timesteps:
              new_betas.append(1 - alpha_cumprod / last_alpha_cumprod)
              last_alpha_cumprod = alpha_cumprod
              timestep_map.append(i)
      kwargs["betas"] = th.tensor(new_betas).numpy()
      super().__init__(**kwargs)
      self.register_buffer(
          "timestep_map", th.tensor(timestep_map), persistent=False
      )
  
file_path: StableDiffusion/ldm/modules/karlo/kakao/modules/diffusion/respace.py
imports: import torch
  from .gaussian_diffusion import GaussianDiffusion
label_desc: Use image node_id 1 to create a new SpacedDiffusion object from inherited base classes: GaussianDiffusion with example: obj = SpacedDiffusion(use_timesteps)