
    bip                         d dl mZ d dlmZmZmZmZ d dlZd dlZd dl	m
Z ddlmZmZ ddlmZmZmZmZmZ ej*                  j                   G d d	             Ze G d
 de             Z G d dee      Zy)    )	dataclass)ListOptionalTupleUnionN   )ConfigMixinregister_to_config   )CommonSchedulerStateFlaxKarrasDiffusionSchedulersFlaxSchedulerMixinFlaxSchedulerOutputadd_noise_commonc                      e Zd ZU eed<   ej                  ed<   ej                  ed<   ej                  ed<   ej                  ed<   ej                  ed<   dZee	   ed<   dZ
eej                     ed	<   dZeej                     ed
<   dZeej                     ed<   dZeej                     ed<   ededej                  dej                  dej                  dej                  dej                  fd       Zy) DPMSolverMultistepSchedulerStatecommonalpha_tsigma_tlambda_tinit_noise_sigma	timestepsNnum_inference_stepsmodel_outputslower_order_numsprev_timestep
cur_samplec                      | ||||||      S )Nr   r   r   r   r   r    )clsr   r   r   r   r   r   s          s/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/diffusers/schedulers/scheduling_dpmsolver_multistep_flax.pycreatez'DPMSolverMultistepSchedulerState.create4   s#     -
 	
    )__name__
__module____qualname__r   __annotations__jnpndarrayr   r   intr   r   int32r   r   classmethodr#   r    r$   r"   r   r   "   s      [[[[kk kk!{{)-#- ,0M8CKK(/,0hsyy)0)-M8CII&-(,J%,
$
 
 	

 ++
 ++
 ;;
 
r$   r   c                       e Zd ZU eed<   y)%FlaxDPMSolverMultistepSchedulerOutputstateN)r%   r&   r'   r   r(   r    r$   r"   r/   r/   H   s    ++r$   r/   c                       e Zd ZU dZeD  cg c]  }|j
                   c}} Zej                  e	d<   e
d        Zedddddd	d
dddddddej                  fdededededeej$                     dedededededededededej                  fd        Zd:d!ee   d"efd#Zd$ed%ed&ed"efd'Zd$ed(ej$                  d)ed*ej$                  d"ej$                  f
d+Zd$ed(ej$                  d)ed,ed*ej$                  d"ej$                  fd-Zd$ed.ej$                  d/ee   d,ed*ej$                  d"ej$                  fd0Zd$ed.ej$                  d/ee   d,ed*ej$                  d"ej$                  fd1Z	 d;d$ed(ej$                  d)ed*ej$                  d2ed"ee ef   fd3Z!	 d:d$ed*ej$                  d)ee   d"ej$                  fd4Z"d$ed5ej$                  d6ej$                  d7ej$                  d"ej$                  f
d8Z#d9 Z$yc c}} w )<FlaxDPMSolverMultistepScheduleral  
    DPM-Solver (and the improved version DPM-Solver++) is a fast dedicated high-order solver for diffusion ODEs with
    the convergence order guarantee. Empirically, sampling by DPM-Solver with only 20 steps can generate high-quality
    samples, and it can generate quite good samples even in only 10 steps.

    For more details, see the original paper: https://huggingface.co/papers/2206.00927 and
    https://huggingface.co/papers/2211.01095

    Currently, we support the multistep DPM-Solver for both noise prediction models and data prediction models. We
    recommend to use `solver_order=2` for guided sampling, and `solver_order=3` for unconditional sampling.

    We also support the "dynamic thresholding" method in Imagen (https://huggingface.co/papers/2205.11487). For
    pixel-space diffusion models, you can set both `algorithm_type="dpmsolver++"` and `thresholding=True` to use the
    dynamic thresholding. Note that the thresholding method is unsuitable for latent-space diffusion models (such as
    stable-diffusion).

    [`~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://huggingface.co/papers/2206.00927 and
    https://huggingface.co/papers/2211.01095

    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 (`np.ndarray`, optional):
            option to pass an array of betas directly to the constructor to bypass `beta_start`, `beta_end` etc.
        solver_order (`int`, default `2`):
            the order of DPM-Solver; can be `1` or `2` or `3`. We recommend to use `solver_order=2` for guided
            sampling, and `solver_order=3` for unconditional sampling.
        prediction_type (`str`, default `epsilon`):
            indicates whether the model predicts the noise (epsilon), or the data / `x0`. One of `epsilon`, `sample`,
            or `v-prediction`.
        thresholding (`bool`, default `False`):
            whether to use the "dynamic thresholding" method (introduced by Imagen,
            https://huggingface.co/papers/2205.11487). For pixel-space diffusion models, you can set both
            `algorithm_type=dpmsolver++` and `thresholding=True` to use the dynamic thresholding. Note that the
            thresholding method is unsuitable for latent-space diffusion models (such as stable-diffusion).
        dynamic_thresholding_ratio (`float`, default `0.995`):
            the ratio for the dynamic thresholding method. Default is `0.995`, the same as Imagen
            (https://huggingface.co/papers/2205.11487).
        sample_max_value (`float`, default `1.0`):
            the threshold value for dynamic thresholding. Valid only when `thresholding=True` and
            `algorithm_type="dpmsolver++`.
        algorithm_type (`str`, default `dpmsolver++`):
            the algorithm type for the solver. Either `dpmsolver` or `dpmsolver++`. The `dpmsolver` type implements the
            algorithms in https://huggingface.co/papers/2206.00927, and the `dpmsolver++` type implements the
            algorithms in https://huggingface.co/papers/2211.01095. We recommend to use `dpmsolver++` with
            `solver_order=2` for guided sampling (e.g. stable-diffusion).
        solver_type (`str`, default `midpoint`):
            the solver type for the second-order solver. Either `midpoint` or `heun`. The solver type slightly affects
            the sample quality, especially for small number of steps. We empirically find that `midpoint` solvers are
            slightly better, so we recommend to use the `midpoint` type.
        lower_order_final (`bool`, default `True`):
            whether to use lower-order solvers in the final steps. Only valid for < 15 inference steps. We empirically
            find this trick can stabilize the sampling of DPM-Solver for steps < 15, especially for steps <= 10.
        timestep_spacing (`str`, defaults to `"linspace"`):
            The way the timesteps should be scaled. Refer to Table 2 of the [Common Diffusion Noise Schedules and
            Sample Steps are Flawed](https://huggingface.co/papers/2305.08891) for more information.
        dtype (`jnp.dtype`, *optional*, defaults to `jnp.float32`):
            the `dtype` used for params and computation.
    dtypec                      y)NTr    selfs    r"   	has_statez)FlaxDPMSolverMultistepScheduler.has_state   s    r$   i  g-C6?g{Gz?linearNr   epsilonFgףp=
?      ?dpmsolver++midpointTlinspacenum_train_timesteps
beta_startbeta_endbeta_scheduletrained_betassolver_orderprediction_typethresholdingdynamic_thresholding_ratiosample_max_valuealgorithm_typesolver_typelower_order_finaltimestep_spacingc                     || _         y Nr3   )r6   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   r3   s                   r"   __init__z(FlaxDPMSolverMultistepScheduler.__init__   s    & 
r$   r   returnc                    |t        j                  |       }t        j                  |j                        }t        j                  d|j                  z
        }t        j
                  |      t        j
                  |      z
  }| j                  j                  dvr.t        | j                  j                   d| j                         | j                  j                  dvr.t        | j                  j                   d| j                         t        j                  d| j                        }t        j                  d| j                  j                        j                         d d d   }t         j                  ||||||	      S )
Nr   )	dpmsolverr;   z is not implemented for )r<   heunr:   rN   r   r   )r   r#   r)   sqrtalphas_cumprodlogconfigrH   NotImplementedError	__class__rI   arrayr3   aranger>   roundr   )r6   r   r   r   r   r   r   s          r"   create_statez,FlaxDPMSolverMultistepScheduler.create_state   sK   >)006F ((6001((1v4445777#cggg&66 ;;%%-II%)C)C(DD\]a]k]k\l&mnn;;""*>>%)@)@(AAYZ^ZhZhYi&jkk 99S

;JJq$++"A"ABHHJ4R4P	/66- 7 
 	
r$   r0   r   shapec                    | j                   j                  }| j                   j                  dk(  rSt        j                  d|dz
  |dz         j                         ddd   dd j                  t        j                        }nD| j                   j                  dk(  r||dz   z  }t        j                  d|dz         |z  j                         ddd   dd j                         j                  t        j                        }|| j                   j                  z  }n| j                   j                  dk(  rp| j                   j                  |z  }t        j                  |d|       j                         j                         j                  t        j                        }|dz  }n"t        | j                   j                   d      t        j                  | j                   j                  f|z   | j                  	      }t        j                  d      }t        j                  d      }	t        j                  || j                  	      }
|j                  |||||	|

      S )a  
        Sets the discrete timesteps used for the diffusion chain. Supporting function to be run before inference.

        Args:
            state (`DPMSolverMultistepSchedulerState`):
                the `FlaxDPMSolverMultistepScheduler` state data class instance.
            num_inference_steps (`int`):
                the number of diffusion steps used when generating samples with a pre-trained model.
            shape (`Tuple`):
                the shape of the samples to be generated.
        r=   r   r   NrT   leadingtrailingzY is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'.rN   )r   r   r   r   r   r   )rX   r>   rK   r)   r=   r]   astyper,   r\   copysteps_offset
ValueErrorzerosrC   r3   replace)r6   r0   r   r_   last_timestepr   
step_ratior   r   r   r   s              r"   set_timestepsz-FlaxDPMSolverMultistepScheduler.set_timesteps   s    77;;'':5Q 13F3JKQQSTXVXTXYZ][]^eefifofop  [[))Y6&+>+BCJ A2Q67*DKKMdPRdSTWUWX]]_ffgjgpgpq  111I[[))Z788;NNJ 

=!j[AGGINNPWWX[XaXabINI;;//0  1J  K  		4;;#;#;"="ETZZX99Q<		"YYuDJJ7
}} 3'-'!  
 	
r$   model_outputtimestepsamplec           
         | j                   j                  dk(  r| j                   j                  dk(  r*|j                  |   |j                  |   }}|||z  z
  |z  }n| j                   j                  dk(  r|}nf| j                   j                  dk(  r*|j                  |   |j                  |   }}||z  ||z  z
  }n#t        d| j                   j                   d      | j                   j                  rt        j                  t        j                  |      | j                   j                  t        t        d|j                                    }t        j                  || j                   j                  t        j                   |      z        }t        j"                  || |      |z  }|S | j                   j                  d	k(  r| j                   j                  dk(  r|S | j                   j                  dk(  r+|j                  |   |j                  |   }}|||z  z
  |z  }	|	S | j                   j                  dk(  r+|j                  |   |j                  |   }}||z  ||z  z   }	|	S t        d| j                   j                   d      y
)a  
        Convert the model output to the corresponding type that the algorithm (DPM-Solver / DPM-Solver++) needs.

        DPM-Solver is designed to discretize an integral of the noise prediction model, and DPM-Solver++ is designed to
        discretize an integral of the data prediction model. So we need to first convert the model output to the
        corresponding type to match the algorithm.

        Note that the algorithm type and the model type is decoupled. That is to say, we can use either DPM-Solver or
        DPM-Solver++ for both noise prediction model and data prediction model.

        Args:
            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.

        Returns:
            `jnp.ndarray`: the converted model output.
        r;   r9   rn   v_predictionzprediction_type given as z` must be one of `epsilon`, `sample`,  or `v_prediction` for the FlaxDPMSolverMultistepScheduler.r   axisrR   N)rX   rH   rD   r   r   rf   rE   r)   
percentileabsrF   tuplerangendimmaximumrG   	ones_likeclip)
r6   r0   rl   rm   rn   r   r   x0_preddynamic_max_valr9   s
             r"   convert_model_outputz4FlaxDPMSolverMultistepScheduler.convert_model_output  s_   6 ;;%%6{{**i7#(==#:EMM(<S!Gl$::gE,,8&,,>#(==#:EMM(<S!F*W|-CC /0K0K/L MR R 
 {{''"%..GGG$dkk&L&LSXY^_`bibnbnYoSp# #&++#T[[%A%ACMMRaDb%b# ((7_,<oNQ``N[['';6{{**i7##,,8#(==#:EMM(<S!Gl$::gE,,>#(==#:EMM(<S!L07V3CC /0K0K/L MR R  7r$   r   c                    ||}}|}|j                   |   |j                   |   }
}	|j                  |   |j                  |   }}|j                  |   |j                  |   }}|	|
z
  }| j                  j                  dk(  r*||z  |z  |t        j                  |       dz
  z  |z  z
  }|S | j                  j                  dk(  r'||z  |z  |t        j                  |      dz
  z  |z  z
  }S )ay  
        One step for the first-order DPM-Solver (equivalent to DDIM).

        See https://huggingface.co/papers/2206.00927 for the detailed derivation.

        Args:
            model_output (`jnp.ndarray`): direct output from learned diffusion model.
            timestep (`int`): current discrete timestep in the diffusion chain.
            prev_timestep (`int`): previous discrete timestep in the diffusion chain.
            sample (`jnp.ndarray`):
                current instance of sample being created by diffusion process.

        Returns:
            `jnp.ndarray`: the sample tensor at the previous timestep.
        r;   r:   rR   r   r   r   rX   rH   r)   exp)r6   r0   rl   rm   r   rn   ts0m0r   lambda_sr   alpha_sr   sigma_shx_ts                    r"   dpm_solver_first_order_updatez=FlaxDPMSolverMultistepScheduler.dpm_solver_first_order_updateI  s    . x2"^^A.r0B( ==+U]]2-> ==+U]]2->x;;%%6W$.'SWWaR[3=N2OSU1UUC 
 [['';6W$.'SWWQZ#=M2NRT1TTC
r$   model_output_listtimestep_listc                    ||d   |d   }}}|d   |d   }
}	|j                   |   |j                   |   |j                   |   }}}|j                  |   |j                  |   }}|j                  |   |j                  |   }}||z
  ||z
  }}||z  }|	d|z  |	|
z
  z  }}| j                  j                  dk(  r| j                  j
                  dk(  rM||z  |z  |t        j                  |       dz
  z  |z  z
  d|t        j                  |       dz
  z  z  |z  z
  }|S | j                  j
                  dk(  rN||z  |z  |t        j                  |       dz
  z  |z  z
  |t        j                  |       dz
  |z  dz   z  |z  z   }S | j                  j                  dk(  r| j                  j
                  dk(  rK||z  |z  |t        j                  |      dz
  z  |z  z
  d|t        j                  |      dz
  z  z  |z  z
  }|S | j                  j
                  dk(  rL||z  |z  |t        j                  |      dz
  z  |z  z
  |t        j                  |      dz
  |z  dz
  z  |z  z
  }S )	ac  
        One step for the second-order multistep DPM-Solver.

        Args:
            model_output_list (`List[jnp.ndarray]`):
                direct outputs from learned diffusion model at current and latter timesteps.
            timestep (`int`): current and latter discrete timestep in the diffusion chain.
            prev_timestep (`int`): previous discrete timestep in the diffusion chain.
            sample (`jnp.ndarray`):
                current instance of sample being created by diffusion process.

        Returns:
            `jnp.ndarray`: the sample tensor at the previous timestep.
        rT   r:   r;   r<         ?rS   rR   )r   r   r   rX   rH   rI   r)   r   )r6   r0   r   r   r   rn   r   r   s1r   m1r   	lambda_s0	lambda_s1r   alpha_s0r   sigma_s0r   h_0r0D0D1r   s                           r"   (multistep_dpm_solver_second_order_updatezHFlaxDPMSolverMultistepScheduler.multistep_dpm_solver_second_order_updatel  s   , "=#4mB6Gr2"2&(9"(=B).):ENN2<NPUP^P^_aPbY)!MM!,emmB.?!MM!,emmB.?I%y9'<31WcBh27+B;;%%6{{&&*4x'61#''1"+"34:;Wc(9:;b@A 2 
) ((F2x'61#''1"+"34:;377A2;#4"9C"?@BFG & 
 [['';6{{&&*4x'61#''!*s"23r9:W
S(89:R?@  
 ((F2x'61#''!*s"23r9:3771:#3q"83">?2EF 
 
r$   c                 ,   ||d   |d   |d   f\  }}}}	|d   |d   |d   }}}
|j                   |   |j                   |   |j                   |   |j                   |	   f\  }}}}|j                  |   |j                  |   }}|j                  |   |j                  |   }}||z
  ||z
  ||z
  }}}||z  ||z  }}|
}d|z  |
|z
  z  d|z  ||z
  z  }}||||z   z  ||z
  z  z   }d||z   z  ||z
  z  }| j                  j                  dk(  r|||z  |z  |t        j                  |       dz
  z  |z  z
  |t        j                  |       dz
  |z  dz   z  |z  z   |t        j                  |       dz
  |z   |dz  z  dz
  z  |z  z
  }|S | j                  j                  dk(  rw||z  |z  |t        j                  |      dz
  z  |z  z
  |t        j                  |      dz
  |z  dz
  z  |z  z
  |t        j                  |      dz
  |z
  |dz  z  dz
  z  |z  z
  }S )	ab  
        One step for the third-order multistep DPM-Solver.

        Args:
            model_output_list (`List[jnp.ndarray]`):
                direct outputs from learned diffusion model at current and latter timesteps.
            timestep (`int`): current and latter discrete timestep in the diffusion chain.
            prev_timestep (`int`): previous discrete timestep in the diffusion chain.
            sample (`jnp.ndarray`):
                current instance of sample being created by diffusion process.

        Returns:
            `jnp.ndarray`: the sample tensor at the previous timestep.
        rT   r   r:   r;   r   r   rR   r   ) r6   r0   r   r   r   rn   r   r   r   s2r   r   m2r   r   r   	lambda_s2r   r   r   r   r   r   h_1r   r1r   D1_0D1_1r   D2r   s                                    r"   'multistep_dpm_solver_third_order_updatezGFlaxDPMSolverMultistepScheduler.multistep_dpm_solver_third_order_update  s   , &}R'8-:K][]M^^2r2&r*,=b,ACTUWCXBNN1NN2NN2NN2	5
1)Y	 "MM!,emmB.?!MM!,emmB.?*I	,A9yCX3q#'BBh27+cBh27-CdR27^t44R"Wo$+.;;%%6 8#v-cggqbkC/0B67swwr{S0A5;<BC swwr{S0141<sBCrIJ  
 [['';6 8#v-cggaj3./256swwqzC/14s:;rAB swwqzC/!3q!t;cABbHI  
r$   return_dictc           
          |j                   t        d      t        j                  |j                  |k(  d      \  d   t
        j                  j                  t        |j                        dz
  k(  d|j                  dz            } j                  ||||      }t        j                  |j                  dd      }|j                  d   j                  |      }|j                  |||      }dt        d	t        j                   f fd
}dt        d	t        j                   f fd}	 ||      }
 |	|      } j"                  j$                  dk(  r|
}nÉ j"                  j&                  rt        |j                        dk  rgt
        j                  j                  |j(                  dk  |
t
        j                  j                  t        |j                        dz
  k(  |
|            }n.t
        j                  j                  |j(                  dk  |
|      }|j                  t        j*                  |j(                  dz    j"                  j$                              }|s||fS t-        ||      S )a  
        Predict the sample at the previous timestep by DPM-Solver. Core function to propagate the diffusion process
        from the learned model outputs (most often the predicted noise).

        Args:
            state (`DPMSolverMultistepSchedulerState`):
                the `FlaxDPMSolverMultistepScheduler` 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 FlaxDPMSolverMultistepSchedulerOutput class

        Returns:
            [`FlaxDPMSolverMultistepSchedulerOutput`] or `tuple`: [`FlaxDPMSolverMultistepSchedulerOutput`] if
            `return_dict` is True, otherwise a `tuple`. When returning a tuple, the first element is the sample tensor.

        zaNumber of inference steps is 'None', you need to run 'set_timesteps' after creating the schedulerr   )sizer   rT   rq   )r   r   r   r0   rP   c                     j                  | | j                  d   | j                     | j                  | j                        S )NrT   )r   r   r   r   r   )r0   r6   
step_indexs    r"   step_1z4FlaxDPMSolverMultistepScheduler.step.<locals>.step_1  sE    55##B'
+##   r$   c           
      R   dt         dt        j                  ffd}dt         dt        j                  ffd} ||       } ||       }j                  j                  dk(  r|S j                  j
                  r~t        | j                        dk  rft        j                  j                  | j                  dk  |t        j                  j                  t        | j                        dz
  k(  ||            S t        j                  j                  | j                  dk  ||      S )Nr0   rP   c                     t        j                  | j                  dz
     | j                     g      }j                  | | j                  || j
                  | j                        S )Nr   )r)   r[   r   r   r   r   r   r0   r   r6   r   s     r"   step_2zEFlaxDPMSolverMultistepScheduler.step.<locals>.step_23.<locals>.step_2  sa     #		5??:>+JEOO\fLg*h iDD''!''$$ r$   c                     t        j                  | j                  dz
     | j                  dz
     | j                     g      }j                  | | j                  || j
                  | j                        S )Nr   r   )r)   r[   r   r   r   r   r   r   s     r"   step_3zEFlaxDPMSolverMultistepScheduler.step.<locals>.step_23.<locals>.step_3"  sx     #		
Q7
Q7
3! CC''!''$$ r$   r      )r   r)   r*   rX   rC   rJ   lenr   jaxlaxselectr   )r0   r   r   step_2_outputstep_3_outputr6   r   s        r"   step_23z5FlaxDPMSolverMultistepScheduler.step.<locals>.step_23  s    > 3;; > 3;;   #5MM"5MM{{''1,$$..3u3G"3Lww~~**Q.!GGNN"c%//&:Q&>>%%  ww~~**Q.!! r$   r   )r   )prev_sampler0   )r   rf   r)   wherer   r   r   r   r   r}   rollr   atsetrh   r   r*   rX   rC   rJ   r   minimumr/   )r6   r0   rl   rm   rn   r   r   model_outputs_newr   r   step_1_outputstep_23_outputr   r   s   `            @r"   stepz$FlaxDPMSolverMultistepScheduler.step  s1   4 $$,s  		%//X"=AF]
zS5IA5M'MqRWRaRablopbpRqr00hPVWHHU%8%8"1E-00488F+'  
	: 	s{{ 	/	; /	 /	b u ;;##q('K[[**s5??/Cb/H''..&&*#eoo"6"::!"K ''..&&*K  [[)?)?!)CT[[E]E]^  
 ''4TYZZr$   c                     |S )a  
        Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
        current timestep.

        Args:
            state (`DPMSolverMultistepSchedulerState`):
                the `FlaxDPMSolverMultistepScheduler` state data class instance.
            sample (`jnp.ndarray`): input sample
            timestep (`int`, optional): current timestep

        Returns:
            `jnp.ndarray`: scaled input sample
        r    )r6   r0   rn   rm   s       r"   scale_model_inputz1FlaxDPMSolverMultistepScheduler.scale_model_inputi  s	      r$   original_samplesnoiser   c                 2    t        |j                  |||      S rM   )r   r   )r6   r0   r   r   r   s        r"   	add_noisez)FlaxDPMSolverMultistepScheduler.add_noise{  s      .>yQQr$   c                 .    | j                   j                  S rM   )rX   r>   r5   s    r"   __len__z'FlaxDPMSolverMultistepScheduler.__len__  s    {{...r$   rM   )T)%r%   r&   r'   __doc__r   name_compatiblesr)   r3   r(   propertyr7   r
   float32r+   floatstrr   r*   boolrO   r   r   r^   r   rk   r}   r   r   r   r   r   r/   r   r   r   r   ).0es   00r"   r2   r2   M   s   CJ %BBqAFFBL99   $("%/3(",1"%+%"& *;;!   	
   ,    %*         yy! (
8,@#A 
Mm 
:4
54
LO4
X]4
	)4
lD/D kkD 	D
 D 
DL!/! kk! 	!
 ! ! 
!F:/: ;;: Cy	:
 : : 
:x6/6 ;;6 Cy	6
 6 6 
6| !G[/G[ kkG[ 	G[
 G[ G[ 
4e;	<G[T gk5?B{{V^_bVc	$R/R ++R {{	R
 ;;R 
R/c Cs   G1r2   )dataclassesr   typingr   r   r   r   flaxr   	jax.numpynumpyr)   configuration_utilsr	   r
   scheduling_utils_flaxr   r   r   r   r   structr   r/   r2   r    r$   r"   <module>r      sw   " " / /  
  A  "
 "
 "
J ,,? , ,x/&8+ x/r$   