o
    ۷i"                  	   @   s   d dl Z d dlmZ d dlmZmZmZmZmZm	Z	 d dl
Zd dlZd dlZddlmZmZ ddlmZmZ ddlmZmZ e rEd dlZeG d	d
 d
eZG dd dZG dd dZ		ddededed dejfddZG dd deeZ dS )    N)	dataclass)CallableListLiteralOptionalTupleUnion   )ConfigMixinregister_to_config)
BaseOutputis_scipy_available   )KarrasDiffusionSchedulersSchedulerMixinc                   @   s.   e Zd ZU dZejed< dZejdB ed< dS )DPMSolverSDESchedulerOutputaq  
    Output class for the scheduler's `step` function output.

    Args:
        prev_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images):
            Computed sample `(x_{t-1})` of previous timestep. `prev_sample` should be used as next model input in the
            denoising loop.
        pred_original_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images):
            The predicted denoised sample `(x_{0})` based on the model output from the current timestep.
            `pred_original_sample` can be used to preview progress or for guidance.
    prev_sampleNpred_original_sample)__name__
__module____qualname____doc__torchTensor__annotations__r    r   r   c/home/ubuntu/vllm_env/lib/python3.10/site-packages/diffusers/schedulers/scheduling_dpmsolver_sde.pyr       s   
 
r   c                   @   s|   e Zd ZdZ	ddejdededeee	e
e	 f  fddZed	ed
edeeeef fddZdededejfddZdS )BatchedBrownianTreezGA wrapper around torchsde.BrownianTree that enables batches of entropy.Nxt0t1seedc                    s   |   \ | _|dt||d u r tddg  }d| _zt||j	d ks/J d W n t
yC   |g}d| _Y nw  fdd|D | _d S )Nw0r   l    TFc                    s.   g | ]}t j jjj|d ddd	qS )ư>   T)	r   r    sizedtypedeviceentropytol	pool_sizehalfway_tree)torchsdeBrownianIntervalshaper&   r'   ).0sr   r    r"   r   r   
<listcomp>I   s    z0BatchedBrownianTree.__init__.<locals>.<listcomp>)sortsigngetr   
zeros_likerandintitembatchedlenr.   	TypeErrortrees)selfr   r   r    r!   kwargsr   r1   r   __init__6   s   
zBatchedBrownianTree.__init__abreturnc                 C   s   | |k r	| |dfS || dfS )a  
        Sorts two float values and returns them along with a sign indicating if they were swapped.

        Args:
            a (`float`):
                The first value.
            b (`float`):
                The second value.

        Returns:
            `Tuple[float, float, float]`:
                A tuple containing the sorted values (min, max) and a sign (1.0 if a < b, -1.0 otherwise).
              ?g      r   )r@   rA   r   r   r   r3   X   s   zBatchedBrownianTree.sortc                    sJ   |   \ }t fdd| jD | j|  }| jr!|S |d S )Nc                    s   g | ]}| qS r   r   )r/   treer   r    r   r   r2   k   s    z0BatchedBrownianTree.__call__.<locals>.<listcomp>r   )r3   r   stackr<   r4   r9   )r=   r   r    r4   wr   rE   r   __call__i   s   &zBatchedBrownianTree.__call__N)r   r   r   r   r   r   floatr   r   intr   r?   staticmethodr   r3   rH   r   r   r   r   r   3   s    
""r   c                   @   sl   e Zd ZdZddd fdejdededeee	e
e	 f  d	eegef f
d
dZdededejfddZdS )BrownianTreeNoiseSampleraz  A noise sampler backed by a torchsde.BrownianTree.

    Args:
        x (`torch.Tensor`): The tensor whose shape, device and dtype is used to generate random samples.
        sigma_min (`float`): The low end of the valid interval.
        sigma_max (`float`): The high end of the valid interval.
        seed (`int` or `List[int]`): The random seed. If a list of seeds is
            supplied instead of a single integer, then the noise sampler will use one BrownianTree per batch item, each
            with its own seed.
        transform (`callable`): A function that maps sigma to the sampler's
            internal timestep.
    Nc                 C   s   | S rI   r   )r   r   r   r   <lambda>   s    z!BrownianTreeNoiseSampler.<lambda>r   	sigma_min	sigma_maxr!   	transformc                 C   s<   || _ |  t||  t|}}t||||| _d S rI   )rQ   r   	as_tensorr   rD   )r=   r   rO   rP   r!   rQ   r   r    r   r   r   r?   }   s   "z!BrownianTreeNoiseSampler.__init__sigma
sigma_nextrB   c                 C   s>   |  t||  t|}}| ||||    S rI   )rQ   r   rR   rD   abssqrt)r=   rS   rT   r   r    r   r   r   rH      s   "z!BrownianTreeNoiseSampler.__call__)r   r   r   r   r   r   rJ   r   r   rK   r   r   r?   rH   r   r   r   r   rM   o   s     
rM   +?cosinenum_diffusion_timestepsmax_betaalpha_transform_type)rX   explaplacerB   c                 C   s   |dkr	dd }n|dkrdd }n|dkrdd }nt d| g }t| D ]}||  }|d	 |  }|td	||||  | q(tj|tjd
S )a>  
    Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of
    (1-beta) over time from t = [0,1].

    Contains a function alpha_bar that takes an argument t and transforms it to the cumulative product of (1-beta) up
    to that part of the diffusion process.

    Args:
        num_diffusion_timesteps (`int`):
            The number of betas to produce.
        max_beta (`float`, defaults to `0.999`):
            The maximum beta to use; use values lower than 1 to avoid numerical instability.
        alpha_transform_type (`str`, defaults to `"cosine"`):
            The type of noise schedule for `alpha_bar`. Choose from `cosine`, `exp`, or `laplace`.

    Returns:
        `torch.Tensor`:
            The betas used by the scheduler to step the model outputs.
    rX   c                 S   s    t | d d t j d d S )NgMb?gT㥛 ?r	   )mathcospitr   r   r   alpha_bar_fn   s    z)betas_for_alpha_bar.<locals>.alpha_bar_fnr]   c              	   S   sP   dt dd|   t ddt d|    d  }t |}t |d|  S )Ng      r         ?r	   r#   )r^   copysignlogfabsr\   rV   )rb   lmbsnrr   r   r   rc      s   4
r\   c                 S   s   t | d S )Ng      ()r^   r\   ra   r   r   r   rc      s   z"Unsupported alpha_transform_type: r   r&   )
ValueErrorrangeappendminr   tensorfloat32)rY   rZ   r[   rc   betasir    t2r   r   r   betas_for_alpha_bar   s   


"rt   c                   @   s  e Zd ZdZdd eD ZdZe							
							dWdede	de	de
d dejee	 B d	B de
d dedededed	B de
d defddZ		dXde	ejB d ejd	B d!efd"d#Zde	ejB d!d	fd$d%Zed!ejfd&d'Zed!eed	f fd(d)Zed!eed	f fd*d+ZdYd,ed!d	fd-d.Zd/ejde	ejB d!ejfd0d1Z				dZd2ed3eejB ded	B d!d	fd4d5Zd6ejd7ejd!ejfd8d9Zd:ejd7ejd!ejfd;d<Zd=ejd!ejfd>d?Z d=ejd2ed!ejfd@dAZ!	Bd[d=ejd2edCe	dDe	d!ejf
dEdFZ"ed!efdGdHZ#	I	Jd\dKejde	ejB d/ejdLedMe	d!e$e%B fdNdOZ&dPejdQejdRejd!ejfdSdTZ'd!efdUdVZ(d	S )]DPMSolverSDEScheduleru
  
    DPMSolverSDEScheduler implements the stochastic sampler from the [Elucidating the Design Space of Diffusion-Based
    Generative Models](https://huggingface.co/papers/2206.00364) paper.

    This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic
    methods the library implements for all schedulers such as loading and saving.

    Args:
        num_train_timesteps (`int`, defaults to 1000):
            The number of diffusion steps to train the model.
        beta_start (`float`, defaults to 0.00085):
            The starting `beta` value of inference.
        beta_end (`float`, defaults to 0.012):
            The final `beta` value.
        beta_schedule (`str`, defaults to `"linear"`):
            The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
            `linear` or `scaled_linear`.
        trained_betas (`np.ndarray`, *optional*):
            Pass an array of betas directly to the constructor to bypass `beta_start` and `beta_end`.
        prediction_type (`str`, defaults to `epsilon`, *optional*):
            Prediction type of the scheduler function; can be `epsilon` (predicts the noise of the diffusion process),
            `sample` (directly predicts the noisy sample`) or `v_prediction` (see section 2.4 of [Imagen
            Video](https://huggingface.co/papers/2210.02303) paper).
        use_karras_sigmas (`bool`, *optional*, defaults to `False`):
            Whether to use Karras sigmas for step sizes in the noise schedule during the sampling process. If `True`,
            the sigmas are determined according to a sequence of noise levels {σi}.
        use_exponential_sigmas (`bool`, *optional*, defaults to `False`):
            Whether to use exponential sigmas for step sizes in the noise schedule during the sampling process.
        use_beta_sigmas (`bool`, *optional*, defaults to `False`):
            Whether to use beta sigmas for step sizes in the noise schedule during the sampling process. Refer to [Beta
            Sampling is All You Need](https://huggingface.co/papers/2407.12173) for more information.
        noise_sampler_seed (`int`, *optional*, defaults to `None`):
            The random seed to use for the noise sampler. If `None`, a random seed is generated.
        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.
        steps_offset (`int`, defaults to 0):
            An offset added to the inference steps, as required by some model families.
    c                 C   s   g | ]}|j qS r   )name)r/   er   r   r   r2      s    z DPMSolverSDEScheduler.<listcomp>r	     _QK?~jt?linearNepsilonFlinspacer   num_train_timesteps
beta_startbeta_endbeta_schedule)r{   scaled_linearsquaredcos_cap_v2trained_betasprediction_type)r|   samplev_predictionuse_karras_sigmasuse_exponential_sigmasuse_beta_sigmasnoise_sampler_seedtimestep_spacing)r}   leadingtrailingsteps_offsetc                 C   s(  | j jrt stdt| j j| j j| j jgdkrtd|d ur,tj	|tj
d| _n:|dkr<tj|||tj
d| _n*|dkrRtj|d |d |tj
dd | _n|d	kr\t|| _n
t| d
| j d| j | _tj| jdd| _| |d | || _d | _|
| _d | _d | _| jd| _d S )Nz:Make sure to install scipy if you want to use beta sigmas.r   znOnly one of `config.use_beta_sigmas`, `config.use_exponential_sigmas`, `config.use_karras_sigmas` can be used.rj   r{   r   rd   r	   r   z is not implemented for rC   r   )dimcpu)configr   r   ImportErrorsumr   r   rk   r   ro   rp   rq   r}   rt   NotImplementedError	__class__alphascumprodalphas_cumprodset_timestepsnoise_samplerr   _step_index_begin_indexsigmasto)r=   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r?      sN   		zDPMSolverSDEScheduler.__init__timestepschedule_timestepsrB   c                 C   s:   |du r| j }||k }t|dkrdnd}||  S )ak  
        Find the index of a given timestep in the timestep schedule.

        Args:
            timestep (`float` or `torch.Tensor`):
                The timestep value to find in the schedule.
            schedule_timesteps (`torch.Tensor`, *optional*):
                The timestep schedule to search in. If `None`, uses `self.timesteps`.

        Returns:
            `int`:
                The index of the timestep in the schedule. For the very first step, returns the second index if
                multiple matches exist to avoid skipping a sigma when starting mid-schedule (e.g., for image-to-image).
        Nr   r   )	timestepsnonzeror:   r8   )r=   r   r   indicesposr   r   r   index_for_timestep0  s
   z(DPMSolverSDEScheduler.index_for_timestepc                 C   s@   | j du rt|tjr|| jj}| || _dS | j	| _dS )z
        Initialize the step index for the scheduler based on the given timestep.

        Args:
            timestep (`float` or `torch.Tensor`):
                The current timestep to initialize the step index from.
        N)
begin_index
isinstancer   r   r   r   r'   r   r   r   )r=   r   r   r   r   _init_step_indexO  s
   
z&DPMSolverSDEScheduler._init_step_indexc                 C   s,   | j jdv r| j S | j d d d S )N)r}   r   r	   r   rd   )r   r   r   maxr=   r   r   r   init_noise_sigma^  s   
z&DPMSolverSDEScheduler.init_noise_sigmac                 C      | j S )zg
        The index counter for current timestep. It will increase 1 after each scheduler step.
        )r   r   r   r   r   
step_indexf     z DPMSolverSDEScheduler.step_indexc                 C   r   )zq
        The index for the first timestep. It should be set from pipeline with `set_begin_index` method.
        r   r   r   r   r   r   m  r   z!DPMSolverSDEScheduler.begin_indexr   c                 C   s
   || _ dS )z
        Sets the begin index for the scheduler. This function should be run from pipeline before the inference.

        Args:
            begin_index (`int`, defaults to `0`):
                The begin index for the scheduler.
        Nr   )r=   r   r   r   r   set_begin_indexu  s   
z%DPMSolverSDEScheduler.set_begin_indexr   c                 C   sH   | j du r
| | | j| j  }| jr|n| j}||d d d  }|S )a  
        Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
        current timestep.

        Args:
            sample (`torch.Tensor`):
                The input sample.
            timestep (`int`, *optional*):
                The current timestep in the diffusion chain.

        Returns:
            `torch.Tensor`:
                A scaled input sample.
        Nr	   r   rd   )r   r   r   state_in_first_ordermid_point_sigma)r=   r   r   rS   sigma_inputr   r   r   scale_model_input  s   

z'DPMSolverSDEScheduler.scale_model_inputnum_inference_stepsr'   c                    s  |_ |pjj}jjdkr"tjd|d |tdddd  }nNjjdkrH|j  }td|| 	 ddd  
t}|jj7 }n(jjdkrg|j  }t|d| 	  
t}|d8 }n	tjj d	tdj j d
 }t| t|tdt||}jjrj|d}t fdd|D }n1jjrj||d}t fdd|D }njjr؈j||d}t fdd|D }| }t|dgg
tj}t|j|d}t|dd |dd d|dd g_ t|}t|}t|dd |dd dg}||ddd< t!|"dr@|j|tjd_#n|j|d_#d_$d_%d_&d_'j d_ d_(dS )aD  
        Sets the discrete timesteps used for the diffusion chain (to be run before inference).

        Args:
            num_inference_steps (`int`):
                The number of diffusion steps used when generating samples with a pre-trained model.
            device (`str` or `torch.device`, *optional*):
                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
            num_train_timesteps (`int`, *optional*):
                The number of train timesteps. If `None`, uses `self.config.num_train_timesteps`.
        r}   r   r   rj   Nr   r   zY is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'.rd   )	in_sigmasc                       g | ]} | qS r   _sigma_to_tr/   rS   
log_sigmasr=   r   r   r2         z7DPMSolverSDEScheduler.set_timesteps.<locals>.<listcomp>)r   r   c                    r   r   r   r   r   r   r   r2     r   c                    r   r   r   r   r   r   r   r2     r   g        )r'   r	   mpsr   ))r   r   r~   r   npr}   rJ   copyarangeroundastyper   rk   arrayr   rf   interpr:   r   _convert_to_karrasr   _convert_to_exponentialr   _convert_to_beta_second_order_timestepsconcatenaterp   r   
from_numpyr   catrepeat_interleaver   str
startswithr   r   r   r   r   r   )r=   r   r'   r~   r   
step_ratior   second_order_timestepsr   r   r   r     sX   &
(


0

$
z#DPMSolverSDEScheduler.set_timestepsr   r   c                    s`   dd }dd }d}||}t |}|d d ||  }||}	t  fdd|	D }
|
S )	Nc                 S   s   t |  S rI   )r   r\   _tr   r   r   sigma_fn     z?DPMSolverSDEScheduler._second_order_timesteps.<locals>.sigma_fnc                 S   s   t |  S rI   )r   rf   _sigmar   r   r   t_fn  r   z;DPMSolverSDEScheduler._second_order_timesteps.<locals>.t_fnrd   r   c                    r   r   r   r   r   r   r   r2     r   zADPMSolverSDEScheduler._second_order_timesteps.<locals>.<listcomp>)r   diffr   )r=   r   r   r   r   midpoint_ratiorb   
delta_time
t_proposedsig_proposedr   r   r   r   r     s   
z-DPMSolverSDEScheduler._second_order_timestepsrS   c                 C   s   t t |d}||ddt jf  }t j|dkddjddj|jd d d}|d }|| }|| }|| ||  }	t |	dd}	d|	 | |	|  }
|
|j}
|
S )a  
        Convert sigma values to corresponding timestep values through interpolation.

        Args:
            sigma (`np.ndarray`):
                The sigma value(s) to convert to timestep(s).
            log_sigmas (`np.ndarray`):
                The logarithm of the sigma schedule used for interpolation.

        Returns:
            `np.ndarray`:
                The interpolated timestep value(s) corresponding to the input sigma(s).
        g|=Nr   )axisr	   )r   r   )	r   rf   maximumnewaxiscumsumargmaxclipr.   reshape)r=   rS   r   	log_sigmadistslow_idxhigh_idxlowhighrG   rb   r   r   r   r     s   ,z!DPMSolverSDEScheduler._sigma_to_tr   c           	      C   s\   |d   }|d   }d}tdd| j}|d|  }|d|  }||||   | }|S )a  
        Construct the noise schedule as proposed in [Elucidating the Design Space of Diffusion-Based Generative
        Models](https://huggingface.co/papers/2206.00364).

        Args:
            in_sigmas (`torch.Tensor`):
                The input sigma values to be converted.

        Returns:
            `torch.Tensor`:
                The converted sigma values following the Karras noise schedule.
        r   r   g      @r   )r8   r   r}   r   )	r=   r   rO   rP   rhorampmin_inv_rhomax_inv_rhor   r   r   r   r      s   z(DPMSolverSDEScheduler._convert_to_karrasc                 C   s   t | jdr| jj}nd}t | jdr| jj}nd}|dur |n|d  }|dur,|n|d  }ttt	|t	||}|S )a  
        Construct an exponential noise schedule.

        Args:
            in_sigmas (`torch.Tensor`):
                The input sigma values to be converted.
            num_inference_steps (`int`):
                The number of inference steps to generate the noise schedule for.

        Returns:
            `torch.Tensor`:
                The converted sigma values following an exponential schedule.
        rO   NrP   r   r   )
hasattrr   rO   rP   r8   r   r\   r}   r^   rf   )r=   r   r   rO   rP   r   r   r   r   r   9  s   

 z-DPMSolverSDEScheduler._convert_to_exponential333333?alphabetac              
      s   t | jdr| jjndt | jdr| jjnddur n|d  dur,n|d  tfdd fddd	tdd	| D D }|S )
a  
        Construct a beta noise schedule as proposed in [Beta Sampling is All You
        Need](https://huggingface.co/papers/2407.12173).

        Args:
            in_sigmas (`torch.Tensor`):
                The input sigma values to be converted.
            num_inference_steps (`int`):
                The number of inference steps to generate the noise schedule for.
            alpha (`float`, *optional*, defaults to `0.6`):
                The alpha parameter for the beta distribution.
            beta (`float`, *optional*, defaults to `0.6`):
                The beta parameter for the beta distribution.

        Returns:
            `torch.Tensor`:
                The converted sigma values following a beta distribution schedule.
        rO   NrP   r   r   c                    s   g | ]
}|    qS r   r   )r/   ppf)rP   rO   r   r   r2     s    z:DPMSolverSDEScheduler._convert_to_beta.<locals>.<listcomp>c                    s   g | ]}t jj| qS r   )scipystatsr   r   )r/   r   )r   r   r   r   r2     s    r   )r   r   rO   rP   r8   r   r   r}   )r=   r   r   r   r   r   r   )r   r   rP   rO   r   r   [  s    

	z&DPMSolverSDEScheduler._convert_to_betac                 C   s
   | j d u S rI   )r   r   r   r   r   r     s   
z*DPMSolverSDEScheduler.state_in_first_orderTrC   model_outputreturn_dicts_noisec                 C   s  | j du r
| | | jdu r,| j| jdk  | j }}t|| | | j| _dt	j
dt	j
fdd}dt	j
dt	j
fdd	}	| jrT| j| j  }
| j| j d
  }n| j| j d
  }
| j| j  }d}|	|
|	|}}|| }|||  }| jjdkr| jr|
n||}|||  }n9| jjdkr| jr|
n||}|| |d d
 d   ||d d
   }n| jjdkrtdtd| jj d|dkr|| |
 }||
 }|||  }ni| jr|}n| j}||}||}t||d |d |d   |d  d }|d |d  d }|	|}|||| | ||  |  }|| ||||| |  }| jr>|| _||| _nd| _d| _|  jd
7  _|sR||fS t||dS )a  
        Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
        process from the learned model outputs (most often the predicted noise).

        Args:
            model_output (`torch.Tensor`):
                The direct output from learned diffusion model.
            timestep (`float` or `torch.Tensor`):
                The current discrete timestep in the diffusion chain.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
            return_dict (`bool`):
                Whether or not to return a [`~schedulers.scheduling_dpmsolver_sde.DPMSolverSDESchedulerOutput`] or
                tuple.
            s_noise (`float`, *optional*, defaults to 1.0):
                Scaling factor for noise added to the sample.

        Returns:
            [`~schedulers.scheduling_dpmsolver_sde.DPMSolverSDESchedulerOutput`] or `tuple`:
                If return_dict is `True`, [`~schedulers.scheduling_dpmsolver_sde.DPMSolverSDESchedulerOutput`] is
                returned, otherwise a tuple is returned where the first element is the sample tensor.
        Nr   r   rB   c                 S      |    S rI   )negr\   r   r   r   r   r     r   z,DPMSolverSDEScheduler.step.<locals>.sigma_fnr   c                 S   r   rI   )rf   r   r   r   r   r   r     r   z(DPMSolverSDEScheduler.step.<locals>.t_fnr   rd   r|   r   r	   r   z+prediction_type not implemented yet: samplezprediction_type given as z, must be one of `epsilon`, or `v_prediction`)r   r   )r   r   r   r   rn   r   rM   r8   r   r   r   r   r   r   r   rk   r   expm1r   r   r   )r=   r   r   r   r   r   	min_sigma	max_sigmar   r   rS   rT   r   rb   t_nextr   r   r   r   
derivativedtr   
sigma_fromsigma_tosigma_up
sigma_downancestral_tr   r   r   step  s|   


 " zDPMSolverSDEScheduler.steporiginal_samplesnoiser   c                    s
  j j|j|jd}|jjdkr)t|r)jj|jtjd |j|jtjd}nj|j ||j}j	du rF fdd|D }nj
durUj
g|jd  }n	j	g|jd  }||  }t|jt|jk r}|d}t|jt|jk sn|||  }|S )	am  
        Add noise to the original samples according to the noise schedule at the specified timesteps.

        Args:
            original_samples (`torch.Tensor`):
                The original samples to which noise will be added.
            noise (`torch.Tensor`):
                The noise tensor to add to the original samples.
            timesteps (`torch.Tensor`):
                The timesteps at which to add noise, determining the noise level from the schedule.

        Returns:
            `torch.Tensor`:
                The noisy samples with added noise scaled according to the timestep schedule.
        )r'   r&   r   rj   Nc                    r   r   )r   )r/   rb   r   r=   r   r   r2   )  r   z3DPMSolverSDEScheduler.add_noise.<locals>.<listcomp>r   r   )r   r   r'   r&   typer   is_floating_pointr   rp   r   r   r.   flattenr:   	unsqueeze)r=   r	  r
  r   r   step_indicesrS   noisy_samplesr   r  r   	add_noise  s"   


zDPMSolverSDEScheduler.add_noisec                 C   s   | j jS rI   )r   r~   r   r   r   r   __len__8  s   zDPMSolverSDEScheduler.__len__)rx   ry   rz   r{   Nr|   FFFNr}   r   rI   )r   )NN)r   r   )TrC   ))r   r   r   r   r   _compatiblesorderr   rK   rJ   r   r   ndarraylistboolr?   r   r   r   r   propertyr   r   r   r   r   r   r   r'   r   r   r   r   r   r   r   r   tupler  r  r  r   r   r   r   ru      s    (	
A



Q%#
0
y
0ru   )rW   rX   )!r^   dataclassesr   typingr   r   r   r   r   r   numpyr   r   r,   configuration_utilsr
   r   utilsr   r   scheduling_utilsr   r   scipy.statsr   r   r   rM   rK   rJ   r   rt   ru   r   r   r   r   <module>   s6    <"
4