class_docstr: Denoising diffusion implicit models is a scheduler that extends the denoising procedure introduced in denoising
  diffusion probabilistic models (DDPMs) with non-Markovian guidance.
  
  [`~ConfigMixin`] takes care of storing all config attributes that are passed in the scheduler's `__init__`
  function, such as `num_train_timesteps`. They can be accessed via `scheduler.config.num_train_timesteps`.
  [`SchedulerMixin`] provides general loading and saving functionality via the [`SchedulerMixin.save_pretrained`] and
  [`~SchedulerMixin.from_pretrained`] functions.
  
  For more details, see the original paper: https://arxiv.org/abs/2010.02502
  
  Args:
      num_train_timesteps (`int`): number of diffusion steps used to train the model.
      beta_start (`float`): the starting `beta` value of inference.
      beta_end (`float`): the final `beta` value.
      beta_schedule (`str`):
          the beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
          `linear`, `scaled_linear`, or `squaredcos_cap_v2`.
      trained_betas (`jnp.ndarray`, optional):
          option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
      clip_sample (`bool`, default `True`):
          option to clip predicted sample between -1 and 1 for numerical stability.
      set_alpha_to_one (`bool`, default `True`):
          each diffusion step uses the value of alphas product at that step and at the previous one. For the final
          step there is no previous alpha. When this option is `True` the previous alpha product is fixed to `1`,
          otherwise it uses the value of alpha at step 0.
      steps_offset (`int`, default `0`):
          an offset added to the inference steps. You can use a combination of `offset=1` and
          `set_alpha_to_one=False`, to make the last step use step 0 for the previous alpha product, as done in
          stable diffusion.
      prediction_type (`str`, default `epsilon`):
          indicates whether the model predicts the noise (epsilon), or the samples. One of `epsilon`, `sample`.
          `v-prediction` is not supported for this scheduler.
      dtype (`jnp.dtype`, *optional*, defaults to `jnp.float32`):
          the `dtype` used for params and computation.
docstr: Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.
  
  Args:
      state (`DDIMSchedulerState`):
          the `FlaxDDIMScheduler` state data class instance.
      num_inference_steps (`int`):
          the number of diffusion steps used when generating samples with a pre-trained model.
docstr_tok: ["Sets","the","discrete","timesteps","used","for","the","diffusion","chain",".","Supporting","function","to","be","run","before","inference",".","Args",":","state","(","`","DDIMSchedulerState","`",")",":","the","`","FlaxDDIMScheduler","`","state","data","class","instance",".","num_inference_steps","(","`","int","`",")",":","the","number","of","diffusion","steps","used","when","generating","samples","with","a","pre-trained","model","."]
code: def set_timesteps(
      self,
      state: DDIMSchedulerState,
      num_inference_steps: int,
      shape: Tuple = (),
  ) -> DDIMSchedulerState:
      """
      Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.
  
      Args:
          state (`DDIMSchedulerState`):
              the `FlaxDDIMScheduler` state data class instance.
          num_inference_steps (`int`):
              the number of diffusion steps used when generating samples with a pre-trained model.
      """
      step_ratio = (
          self.config.num_train_timesteps // num_inference_steps
      )
      # creates integer timesteps by multiplying by ratio
      # rounding to avoid issues when num_inference_step is power of 3
      timesteps = (
          jnp.arange(0, num_inference_steps) * step_ratio
      ).round()[::-1] + self.config.steps_offset
  
      return state.replace(
          num_inference_steps=num_inference_steps,
          timesteps=timesteps,
      )
  
imports: from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import flax
  import jax.numpy
  from ..configuration_utils import ConfigMixin, register_to_config
  from .scheduling_utils_flax import CommonSchedulerState, FlaxKarrasDiffusionSchedulers, FlaxSchedulerMixin, FlaxSchedulerOutput, add_noise_common, get_velocity_common
label_desc: Use image node_id 5 for calling the FlaxDDIMScheduler obj's underlying member method code with example usage: obj.set_timesteps(state, num_inference_steps, shape) and returns: state