code: def __init__(
      self,
      num_train_timesteps=1000,
      beta_start=0.0001,
      beta_end=0.02,
      beta_schedule="linear",
      trained_betas=None,
      timestep_values=None,
      clip_sample=True,
      set_alpha_to_one=True,
      tensor_format="pd",
  ):
      if beta_schedule == "linear":
          self.betas = np.linspace(
              beta_start,
              beta_end,
              num_train_timesteps,
              dtype=np.float32,
          )
      elif beta_schedule == "scaled_linear":
          # this schedule is very specific to the latent diffusion model.
          self.betas = (
              np.linspace(
                  beta_start**0.5,
                  beta_end**0.5,
                  num_train_timesteps,
                  dtype=np.float32,
              )
              ** 2
          )
      elif beta_schedule == "squaredcos_cap_v2":
          # Glide cosine schedule
          self.betas = betas_for_alpha_bar(num_train_timesteps)
      else:
          raise NotImplementedError(
              f"{beta_schedule} does is not implemented for {self.__class__}"
          )
  
      self.alphas = 1.0 - self.betas
      self.alphas_cumprod = np.cumprod(self.alphas, axis=0)
  
      # At every step in ddim, we are looking into the previous alphas_cumprod
      # For the final step, there is no previous alphas_cumprod because we are already at 0
      # `set_alpha_to_one` decides whether we set this paratemer simply to one or
      # whether we use the final alpha of the "non-previous" one.
      self.final_alpha_cumprod = (
          np.array(1.0) if set_alpha_to_one else self.alphas_cumprod[0]
      )
  
      # setable values
      self.num_inference_steps = None
      self.timesteps = np.arange(0, num_train_timesteps)[::-1].copy()
  
      self.tensor_format = tensor_format
      self.set_format(tensor_format=tensor_format)
  
file_path: PaddleHub/modules/image/text_to_image/stable_diffusion_img2img/diffusers/schedulers/scheduling_ddim.py
imports: import math
  from typing import Union
  import numpy
  import paddle
  from ..configuration_utils import ConfigMixin
  from ..configuration_utils import register_to_config
  from .scheduling_utils import SchedulerMixin
label_desc: Use image node_id 1 to create a new DDIMScheduler object from inherited base classes: SchedulerMixin, ConfigMixin with example: obj = DDIMScheduler(num_train_timesteps, beta_start, beta_end, beta_schedule, trained_betas, timestep_values, clip_sample, set_alpha_to_one, tensor_format)