class_docstr: Pseudo numerical methods for diffusion models (PNDM) proposes using more advanced ODE integration techniques,
  namely Runge-Kutta method and a linear multi-step method.
  
  [`~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/2202.09778
  
  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.
      skip_prk_steps (`bool`):
          allows the scheduler to skip the Runge-Kutta steps that are defined in the original paper as being required
          before plms steps; defaults to `False`.
      set_alpha_to_one (`bool`, default `False`):
          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`, optional):
          prediction type of the scheduler function, one of `epsilon` (predicting the noise of the diffusion
          process), `sample` (directly predicting the noisy sample`) or `v_prediction` (see section 2.4
          https://imagen.research.google/video/paper.pdf)
      dtype (`jnp.dtype`, *optional*, defaults to `jnp.float32`):
          the `dtype` used for params and computation.
class_docstr_tok: ["Pseudo","numerical","methods","for","diffusion","models","(","PNDM",")","proposes","using","more","advanced","ODE","integration","techniques",",","namely","Runge-Kutta","method","and","a","linear","multi-step","method",".","[","`","~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\/2202.09778","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",".","skip_prk_steps","(","`","bool","`",")",":","allows","the","scheduler","to","skip","the","Runge-Kutta","steps","that","are","defined","in","the","original","paper","as","being","required","before","plms","steps",";","defaults","to","`","False","`",".","set_alpha_to_one","(","`","bool","`",",","default","`","False","`",")",":","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","`",",","optional",")",":","prediction","type","of","the","scheduler","function",",","one","of","`","epsilon","`","(","predicting","the","noise","of","the","diffusion","process",")",",","`","sample","`","(","directly","predicting","the","noisy","sample","`",")","or","`","v_prediction","`","(","see","section","2.4","https",":","\/\/imagen.research.google\/video\/paper.pdf",")","dtype","(","`","jnp.dtype","`",",","*","optional","*",",","defaults","to","`","jnp.float32","`",")",":","the","`","dtype","`","used","for","params","and","computation","."]
docstr: Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion
  process from the learned model outputs (most often the predicted noise).
  
  This function calls `step_prk()` or `step_plms()` depending on the internal variable `counter`.
  
  Args:
      state (`PNDMSchedulerState`): the `FlaxPNDMScheduler` state data class instance.
      model_output (`jnp.ndarray`): direct output from learned diffusion model.
      timestep (`int`): current discrete timestep in the diffusion chain.
      sample (`jnp.ndarray`):
          current instance of sample being created by diffusion process.
      return_dict (`bool`): option for returning tuple rather than FlaxPNDMSchedulerOutput class
  
  Returns:
      [`FlaxPNDMSchedulerOutput`] or `tuple`: [`FlaxPNDMSchedulerOutput`] if `return_dict` is True, otherwise a
      `tuple`. When returning a tuple, the first element is the sample tensor.
docstr_tok: ["Predict","the","sample","at","the","previous","timestep","by","reversing","the","SDE",".","Core","function","to","propagate","the","diffusion","process","from","the","learned","model","outputs","(","most","often","the","predicted","noise",")",".","This","function","calls","`","step_prk","(",")","`","or","`","step_plms","(",")","`","depending","on","the","internal","variable","`","counter","`",".","Args",":","state","(","`","PNDMSchedulerState","`",")",":","the","`","FlaxPNDMScheduler","`","state","data","class","instance",".","model_output","(","`","jnp.ndarray","`",")",":","direct","output","from","learned","diffusion","model",".","timestep","(","`","int","`",")",":","current","discrete","timestep","in","the","diffusion","chain",".","sample","(","`","jnp.ndarray","`",")",":","current","instance","of","sample","being","created","by","diffusion","process",".","return_dict","(","`","bool","`",")",":","option","for","returning","tuple","rather","than","FlaxPNDMSchedulerOutput","class","Returns",":","[","`","FlaxPNDMSchedulerOutput","`","]","or","`","tuple","`",":","[","`","FlaxPNDMSchedulerOutput","`","]","if","`","return_dict","`","is","True",",","otherwise","a","`","tuple","`",".","When","returning","a","tuple",",","the","first","element","is","the","sample","tensor","."]
code: def step(
      self,
      state: PNDMSchedulerState,
      model_output: jnp.ndarray,
      timestep: int,
      sample: jnp.ndarray,
      return_dict: bool = True,
  ) -> Union[FlaxPNDMSchedulerOutput, Tuple]:
      """
      Predict the sample at the previous timestep by reversing the SDE. Core function to propagate the diffusion
      process from the learned model outputs (most often the predicted noise).
  
      This function calls `step_prk()` or `step_plms()` depending on the internal variable `counter`.
  
      Args:
          state (`PNDMSchedulerState`): the `FlaxPNDMScheduler` state data class instance.
          model_output (`jnp.ndarray`): direct output from learned diffusion model.
          timestep (`int`): current discrete timestep in the diffusion chain.
          sample (`jnp.ndarray`):
              current instance of sample being created by diffusion process.
          return_dict (`bool`): option for returning tuple rather than FlaxPNDMSchedulerOutput class
  
      Returns:
          [`FlaxPNDMSchedulerOutput`] or `tuple`: [`FlaxPNDMSchedulerOutput`] if `return_dict` is True, otherwise a
          `tuple`. When returning a tuple, the first element is the sample tensor.
  
      """
  
      if state.num_inference_steps is None:
          raise ValueError(
              "Number of inference steps is 'None', you need to run 'set_timesteps' after creating the scheduler"
          )
  
      if self.config.skip_prk_steps:
          prev_sample, state = self.step_plms(
              state, model_output, timestep, sample
          )
      else:
          prk_prev_sample, prk_state = self.step_prk(
              state, model_output, timestep, sample
          )
          plms_prev_sample, plms_state = self.step_plms(
              state, model_output, timestep, sample
          )
  
          cond = state.counter < len(state.prk_timesteps)
  
          prev_sample = jax.lax.select(
              cond, prk_prev_sample, plms_prev_sample
          )
  
          state = state.replace(
              cur_model_output=jax.lax.select(
                  cond,
                  prk_state.cur_model_output,
                  plms_state.cur_model_output,
              ),
              ets=jax.lax.select(cond, prk_state.ets, plms_state.ets),
              cur_sample=jax.lax.select(
                  cond, prk_state.cur_sample, plms_state.cur_sample
              ),
              counter=jax.lax.select(
                  cond, prk_state.counter, plms_state.counter
              ),
          )
  
      if not return_dict:
          return (prev_sample, state)
  
      return FlaxPNDMSchedulerOutput(
          prev_sample=prev_sample, state=state
      )
  
imports: from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import flax
  import jax
  import jax.numpy
  from ..configuration_utils import ConfigMixin, register_to_config
  from .scheduling_utils_flax import CommonSchedulerState, FlaxKarrasDiffusionSchedulers, FlaxSchedulerMixin, FlaxSchedulerOutput, add_noise_common
label_desc: Use image node_id 6 for calling the FlaxPNDMScheduler obj's underlying member method code with example usage: obj.step(state, model_output, timestep, sample, return_dict) and returns: FlaxPNDMSchedulerOutput, prev_sample,  state