ó
    "EñiNZ  ã            
       ó”  • S r SSKrSSKrSSKrSSKJrJr  SSKJr  SSK	J
r
JrJrJr  SSKJr  SSKrSSKJr  SSKJr  SS	KJrJr  SS
KJr  SSKJr  / SQrSSKJr  \\\S4   \\   4   rSS jr S r!SS jr"S r# " S S\5      r$\RJ                  " 5        SS\\
   S\S\&\RN                  -  S-  SS4S jj5       r( " S S\5      r)g)z>Implementation for Stochastic Weight Averaging implementation.é    N)ÚCallableÚIterable)Údeepcopy)ÚAnyÚcastÚLiteralÚUnion)Úoverride)ÚTensor)ÚModule)Ú_format_paramÚLRScheduler)Ú&_get_foreach_kernels_supported_devicesé   )Ú	Optimizer)ÚAveragedModelÚ	update_bnÚSWALRÚget_ema_multi_avg_fnÚget_swa_multi_avg_fnÚget_ema_avg_fnÚget_swa_avg_fn)Ú"_group_tensors_by_device_and_dtype.c                 óš   ^ • T S:  d  T S:”  a  [        ST  S35      e[        R                  " 5       S[        S[        SS4U 4S	 jj5       nU$ )
á¡  Get the function applying exponential moving average (EMA) across multiple params.

The EMA is computed as:

.. math::
    W_0^{\text{EMA}} = W_0^{\text{model}}

.. math::
    W_{t+1}^{\text{EMA}} = \text{decay} \times W_t^{\text{EMA}} + (1 - \text{decay}) \times W_{t+1}^{\text{model}}

where :math:`W_t^{\text{EMA}}` is the EMA parameter at step :math:`t`,
:math:`W_t^{\text{model}}` is the model parameter at step :math:`t`,
and :math:`\text{decay}` is the decay rate (default: 0.999).

Args:
    decay (float): Decay rate for EMA. Must be in the range [0, 1]. Default: 0.999

Returns:
    Callable: A function that updates EMA parameters given current model parameters
ç        ç      ð?úInvalid decay value ú1 provided. Please provide a value in [0,1] range.Úema_param_listÚcurrent_param_listÚreturnNc                 ó  >• [         R                  " U S   5      (       d  [         R                  " U S   5      (       a  [         R                  " XST-
  5        g [	        XSS9 H"  u  p4UR                  UT-  UST-
  -  -   5        M$     g )Nr   r   T©Ústrict)ÚtorchÚis_floating_pointÚ
is_complexÚ_foreach_lerp_ÚzipÚcopy_)r    r!   Ú_Úp_emaÚp_modelÚdecays        €ÚR/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/optim/swa_utils.pyÚ
ema_updateÚ(get_ema_multi_avg_fn.<locals>.ema_update@   s~   ø€ ô
 ×"Ò" >°!Ñ#4×5Ñ5¼×9IÒ9IØ˜1Ñ÷:
ñ :
ô × Ò  ÀQÈÁYÕOä"% nÐQUÔ"V‘�Ø—‘˜E E™M¨G°q¸5±yÑ,AÑAÖBò #Wó    )Ú
ValueErrorr&   Úno_gradÚ
PARAM_LIST©r/   r1   s   ` r0   r   r   %   sk   ø€ ð, ˆsƒ{�e˜c“kÜØ" 5 'Ð)ZÐ[ó
ð 	
ô ‡]‚]ƒ_ð
CÜ"ð
CÜ8Bð
Cà	ö
Có ð
Cð Ðr3   c            	      óv   • [         R                  " 5       S[        S[        S[        [        -  SS4S j5       n U $ )zQGet the function applying stochastic weight average (SWA) across multiple params.Úaveraged_param_listr!   Únum_averagedr"   Nc           
      ó´  • [         R                  " U S   5      (       d  [         R                  " U S   5      (       a-  [         R                  " U U[	        [
        SUS-   -  5      5        g [         R                  " X5      n[        U[        5      (       a)  [         R                  " U UUS-   /[        U 5      -  5        g [         R                  " XSUS-   -  S9  g )Nr   r   r   )Úalpha)r&   r'   r(   r)   r   ÚfloatÚ_foreach_subÚ
isinstancer   Ú_foreach_addcdiv_ÚlenÚ_foreach_add_)r9   r!   r:   Údiffss       r0   Ú
swa_updateÚ(get_swa_multi_avg_fn.<locals>.swa_updateS   sÈ   € ô ×"Ò"Ð#6°qÑ#9×:Ñ:¼e×>NÒ>NØ Ñ"÷?
ñ ?
ô × Ò Ø#Ø"Ü”U˜A °Ñ!1Ñ2Ó3õô ×&Ò&Ð'9ÓOˆEÜ˜,¬×/Ñ/Ü×'Ò'Ø'ØØ! AÑ%Ð&¬Ð-@Ó)AÑAõô ×#Ò#Ø'°c¸\ÈAÑ=MÑ6Nór3   )r&   r5   r6   r   Úint©rD   s    r0   r   r   P   sL   € ô ‡]‚]ƒ_ðÜ'ðä&ðô œs‘lðð 
ó	ó ðð6 Ðr3   c                 ó–   ^ • T S:  d  T S:”  a  [        ST  S35      e[        R                  " 5       S[        S[        4U 4S jj5       nU$ )r   r   r   r   r   Ú	ema_paramÚcurrent_paramc                 ó    >• TU -  ST-
  U-  -   $ ©Nr   © )rI   rJ   r:   r/   s      €r0   r1   Ú"get_ema_avg_fn.<locals>.ema_update�   s   ø€ à�yÑ  A¨¡I°Ñ#>Ñ>Ð>r3   )r4   r&   r5   r   r7   s   ` r0   r   r   r   s\   ø€ ð, ˆsƒ{�e˜c“kÜØ" 5 'Ð)ZÐ[ó
ð 	
ô ‡]‚]ƒ_ð?œfð ?´Vö ?ó ð?ð Ðr3   c                  ór   • [         R                  " 5       S[        S[        S[        [        -  4S j5       n U $ )zPGet the function applying stochastic weight average (SWA) across a single param.Úaveraged_paramrJ   r:   c                 ó   • XU -
  US-   -  -   $ rL   rM   )rP   rJ   r:   s      r0   rD   Ú"get_swa_avg_fn.<locals>.swa_update—   s   € ð °Ñ!?ÀLÐSTÑDTÑ UÑUÐUr3   )r&   r5   r   rF   rG   s    r0   r   r   ”   sE   € ô ‡]‚]ƒ_ðVÜðVÜ/5ðVÜEKÌcÁ\óVó ðVð
 Ðr3   c                   óÌ   ^ • \ rS rSr% Sr\\S'       SS\S\\	R                  -  S-  S\\\\\-  /\4   S-  S\\\\\-  /S4   S-  S	S4
U 4S
 jjjrS rS\S	S4S jrSrU =r$ )r   é    as  Implements averaged model for Stochastic Weight Averaging (SWA) and Exponential Moving Average (EMA).

Stochastic Weight Averaging was proposed in `Averaging Weights Leads to
Wider Optima and Better Generalization`_ by Pavel Izmailov, Dmitrii
Podoprikhin, Timur Garipov, Dmitry Vetrov and Andrew Gordon Wilson
(UAI 2018).

Exponential Moving Average is a variation of `Polyak averaging`_,
but using exponential weights instead of equal weights across iterations.

AveragedModel class creates a copy of the provided module :attr:`model`
on the device :attr:`device` and allows to compute running averages of the
parameters of the :attr:`model`.

Args:
    model (torch.nn.Module): model to use with SWA/EMA
    device (torch.device, optional): if provided, the averaged model will be
        stored on the :attr:`device`
    avg_fn (function, optional): the averaging function used to update
        parameters; the function must take in the current value of the
        :class:`AveragedModel` parameter, the current value of :attr:`model`
        parameter, and the number of models already averaged; if None,
        an equally weighted average is used (default: None)
    multi_avg_fn (function, optional): the averaging function used to update
        parameters inplace; the function must take in the current values of the
        :class:`AveragedModel` parameters as a list, the current values of :attr:`model`
        parameters as a list, and the number of models already averaged; if None,
        an equally weighted average is used (default: None)
    use_buffers (bool): if ``True``, it will compute running averages for
        both the parameters and the buffers of the model. (default: ``False``)

Example:
    >>> # xdoctest: +SKIP("undefined variables")
    >>> loader, optimizer, model, loss_fn = ...
    >>> swa_model = torch.optim.swa_utils.AveragedModel(model)
    >>> scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer,
    >>>                                     T_max=300)
    >>> swa_start = 160
    >>> swa_scheduler = SWALR(optimizer, swa_lr=0.05)
    >>> for i in range(300):
    >>>      for input, target in loader:
    >>>          optimizer.zero_grad()
    >>>          loss_fn(model(input), target).backward()
    >>>          optimizer.step()
    >>>      if i > swa_start:
    >>>          swa_model.update_parameters(model)
    >>>          swa_scheduler.step()
    >>>      else:
    >>>          scheduler.step()
    >>>
    >>> # Update bn statistics for the swa_model at the end
    >>> torch.optim.swa_utils.update_bn(loader, swa_model)

You can also use custom averaging functions with the `avg_fn` or `multi_avg_fn` parameters.
If no averaging function is provided, the default is to compute
equally-weighted average of the weights (SWA).

Example:
    >>> # xdoctest: +SKIP("undefined variables")
    >>> # Compute exponential moving averages of the weights and buffers
    >>> ema_model = torch.optim.swa_utils.AveragedModel(model,
    >>>             torch.optim.swa_utils.get_ema_multi_avg_fn(0.9), use_buffers=True)

.. note::
    When using SWA/EMA with models containing Batch Normalization you may
    need to update the activation statistics for Batch Normalization.
    This can be done either by using the :meth:`torch.optim.swa_utils.update_bn`
    or by setting :attr:`use_buffers` to `True`. The first approach updates the
    statistics in a post-training step by passing data through the model. The
    second does it during the parameter update phase by averaging all buffers.
    Empirical evidence has shown that updating the statistics in normalization
    layers increases accuracy, but you may wish to empirically test which
    approach yields the best results in your problem.

.. note::
    :attr:`avg_fn` and `multi_avg_fn` are not saved in the :meth:`state_dict` of the model.

.. note::
    When :meth:`update_parameters` is called for the first time (i.e.
    :attr:`n_averaged` is `0`) the parameters of `model` are copied
    to the parameters of :class:`AveragedModel`. For every subsequent
    call of :meth:`update_parameters` the function `avg_fn` is used
    to update the parameters.

.. _Averaging Weights Leads to Wider Optima and Better Generalization:
    https://arxiv.org/abs/1803.05407
.. _There Are Many Consistent Explanations of Unlabeled Data: Why You Should
    Average:
    https://arxiv.org/abs/1806.05594
.. _SWALP: Stochastic Weight Averaging in Low-Precision Training:
    https://arxiv.org/abs/1904.11943
.. _Stochastic Weight Averaging in Parallel: Large-Batch Training That
    Generalizes Well:
    https://arxiv.org/abs/2001.02312
.. _Polyak averaging:
    https://paperswithcode.com/method/polyak-averaging
Ú
n_averagedNÚmodelÚdeviceÚavg_fnÚmulti_avg_fnr"   c           	      ó6  >• [         TU ]  5         Ub  Ub  [        S5      e[        U5      U l        Ub   U R                  R                  U5      U l        U R                  S[        R                  " S[        R                  US95        X0l
        X@l        XPl        g )Nz6Only one of avg_fn and multi_avg_fn should be providedrU   r   )ÚdtyperW   )ÚsuperÚ__init__ÚAssertionErrorr   ÚmoduleÚtoÚregister_bufferr&   ÚtensorÚlongrX   rY   Úuse_buffers)ÚselfrV   rW   rX   rY   rd   Ú	__class__s         €r0   r]   ÚAveragedModel.__init__  s‰   ø€ ô 	‰ÑÔØÑ ,Ñ":Ü ØHóð ô ˜u“oˆŒØÑØŸ+™+Ÿ.™.¨Ó0ˆDŒKØ×ÑØœ%Ÿ,š, q´·
±
À6ÑJô	
ð ŒØ(ÔØ&Õr3   c                 ó&   • U R                   " U0 UD6$ )zForward pass.)r_   )re   ÚargsÚkwargss      r0   ÚforwardÚAveragedModel.forward  s   € à�{Š{˜DÐ+ FÑ+Ð+r3   c           	      óz  • U R                   (       aG  [        R                  " U R                  R	                  5       U R                  R                  5       5      OU R	                  5       nU R                   (       a3  [        R                  " UR	                  5       UR                  5       5      OUR	                  5       n/ n/ n[        U R                  S:H  5      n[        X#SS9 H†  u  pxUR                  5       R                  UR                  5      n	UR                  UR                  5       5        UR                  U	5        U(       d  Mg  UR                  5       R                  U	5        Mˆ     U R                  S:”  Ga—  U R                  c  U R                  Gc  [!        XE/5      n
U
R#                  5        Hå  u  u  p¼u  u  pÞnU R                  (       a.  U R                  UUU R                  R                  U5      5        ML  UbF  UR$                  ['        5       ;   a.  [)        5       nU" XÞU R                  R                  U5      5        M•  [+        5       nU R                  R                  U5      n[        XÞSS9 H  u  pxUR                  U" XxU5      5        M     Mç     Ov[        XESS9 Hh  u  pxU R                  R                  UR                  5      nUR                  5       R                  U R                  UR                  5       UU5      5        Mj     U R                   (       d�  [        U R                  R                  5       UR                  5       SS9 HL  u  nnUR                  5       R                  UR                  5       R                  UR                  5      5        MN     U =R                  S-  sl        g)zUpdate model parameters.r   Fr$   NTr   )rd   Ú	itertoolsÚchainr_   Ú
parametersÚbuffersÚboolrU   r*   Údetachr`   rW   Úappendr+   rY   rX   r   ÚitemsÚtyper   r   r   )re   rV   Ú
self_paramÚmodel_paramÚself_param_detachedÚmodel_param_detachedÚ
copy_paramÚ
p_averagedr.   Úp_model_Úgrouped_tensorsrW   r,   Úself_paramsÚmodel_paramsrY   rX   rU   Úb_swaÚb_models                       r0   Úupdate_parametersÚAveragedModel.update_parameters!  s  € ð
 ××ô �OŠO˜DŸK™K×2Ñ2Ó4°d·k±k×6IÑ6IÓ6KÔLà—‘Ó"ð	 	ð ××ô �OŠO˜E×,Ñ,Ó.°·±³Ô@à×!Ñ!Ó#ð	 	ð 46ÐØ46ÐÜ˜$Ÿ/™/¨QÑ.Ó/ˆ
Ü#& zÀuÔ#MÑˆJØ—~‘~Ó'×*Ñ*¨:×+<Ñ+<Ó=ˆHØ×&Ñ& z×'8Ñ'8Ó':Ô;Ø ×'Ñ'¨Ô1ßˆzØ×!Ñ!Ó#×)Ñ)¨(Ö3ñ $Nð �?‰?˜QÔØ× Ñ Ñ,°·±Ò0CÜ"DØ(Ð?ó#�ð %×*Ñ*Ö,ñ‘K�Vñ "Ù/�[Øà×(×(Ø×)Ñ)Ø'Ø(Ø ŸO™O×.Ñ.¨vÓ6öð Ñ*Ø"ŸK™KÔ+QÓ+SÓSä';Ó'=˜Ù$Ø'°t·±×7IÑ7IÈ&Ó7Qöô "0Ó!1˜Ø%)§_¡_×%7Ñ%7¸Ó%?˜
Ü36Ø'¸dô4Ñ/˜Jð '×,Ñ,©V°JÈÓ-TÖUó	4ò% -ô0 ,/Ø'Àdô,Ñ'�Jð "&§¡×!3Ñ!3°J×4EÑ4EÓ!F�Jà×%Ñ%Ó'×-Ñ-àŸ™ J×$5Ñ$5Ó$7¸À*ÓMöñ,ð ××ô #&Ø—‘×#Ñ#Ó% u§}¡}£¸tô#‘��wð —‘“×$Ñ$ W§^¡^Ó%5×%8Ñ%8¸¿¹Ó%FÖGñ#ð 	�Š˜1ÑŽr3   )rX   r_   rY   rd   )NNNF)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Ú__annotations__r   rF   r&   rW   r   r6   r]   rk   rƒ   Ú__static_attributes__Ú__classcell__©rf   s   @r0   r   r       sÀ   ø‡ ñ`ðD Óð
 -1ØJNàØñ'àð'ð �e—l‘lÑ" TÑ)ð'ð ˜& &¨&°3©,Ð7¸Ð?Ñ@À4ÑGð	'ð
  
¨J¸À¹ÐEÀtÐKÑLØ
ñð'ð 
÷'ð 'ò0,ðJ vð J°$÷ Jò Jr3   r   ÚloaderrV   rW   r"   c                 ó(  • 0 nUR                  5        H`  n[        U[        R                  R                   R                  R
                  5      (       d  MB  UR                  5         UR                  X4'   Mb     U(       d  gUR                  nUR                  5         U H
  nSUl        M     U  H?  n[        U[        [        45      (       a  US   nUb  UR                  U5      nU" U5        MA     U H  nX7   Ul        M     UR                  U5        g)aD  Update BatchNorm running_mean, running_var buffers in the model.

It performs one pass over data in `loader` to estimate the activation
statistics for BatchNorm layers in the model.

Args:
    loader (torch.utils.data.DataLoader): dataset loader to compute the
        activation statistics on. Each data batch should be either a
        tensor, or a list/tuple whose first element is a tensor
        containing data.
    model (torch.nn.Module): model for which we seek to update BatchNorm
        statistics.
    device (torch.device, optional): If set, data will be transferred to
        :attr:`device` before being passed into :attr:`model`.

Example:
    >>> # xdoctest: +SKIP("Undefined variables")
    >>> loader, model = ...
    >>> torch.optim.swa_utils.update_bn(loader, model)

.. note::
    The `update_bn` utility assumes that each data batch in :attr:`loader`
    is either a tensor or a list or tuple of tensors; in the latter case it
    is assumed that :meth:`model.forward()` should be called on the first
    element of the list or tuple corresponding to the data batch.
Nr   )Úmodulesr?   r&   ÚnnÚ	batchnormÚ
_BatchNormÚreset_running_statsÚmomentumÚtrainingÚtrainÚlistÚtupler`   )rŽ   rV   rW   Úmomentar_   Úwas_trainingÚinputÚ	bn_modules           r0   r   r   n  sã   € ð@ €GØ—-‘-–/ˆÜ�fœeŸh™h×.Ñ.×8Ñ8×CÑC×DÓDØ×&Ñ&Ô(Ø$Ÿo™oˆG‹Oñ "ö
 Øà—>‘>€LØ	‡K�K„MÛˆØˆŽñ ó ˆÜ�eœd¤E˜]×+Ñ+Ø˜!‘HˆEØÑØ—H‘H˜VÓ$ˆEáˆeŽñ ó ˆ	Ø$Ñ/ˆ	Öñ à	‡K�K�Õr3   c            	       óð   ^ • \ rS rSrSr   SS\S\S\S   SS4U 4S	 jjjr\	S
 5       r
\	S 5       r\	S 5       r\S 5       rS\S   SS4S jr\S\\\4   4S j5       r\S\\\4   SS4S j5       rSrU =r$ )r   i©  a´  Anneals the learning rate in each parameter group to a fixed value.

This learning rate scheduler is meant to be used with Stochastic Weight
Averaging (SWA) method (see `torch.optim.swa_utils.AveragedModel`).

Args:
    optimizer (torch.optim.Optimizer): wrapped optimizer
    swa_lrs (float or list): the learning rate value for all param groups
        together or separately for each group.
    annealing_epochs (int): number of epochs in the annealing phase
        (default: 10)
    annealing_strategy (str): "cos" or "linear"; specifies the annealing
        strategy: "cos" for cosine annealing, "linear" for linear annealing
        (default: "cos")
    last_epoch (int): the index of the last epoch (default: -1)

The :class:`SWALR` scheduler can be used together with other
schedulers to switch to a constant learning rate late in the training
as in the example below.

Example:
    >>> # xdoctest: +SKIP("Undefined variables")
    >>> loader, optimizer, model = ...
    >>> lr_lambda = lambda epoch: 0.9
    >>> scheduler = torch.optim.lr_scheduler.MultiplicativeLR(optimizer,
    >>>        lr_lambda=lr_lambda)
    >>> swa_scheduler = torch.optim.swa_utils.SWALR(optimizer,
    >>>        anneal_strategy="linear", anneal_epochs=20, swa_lr=0.05)
    >>> swa_start = 160
    >>> for i in range(300):
    >>>      for input, target in loader:
    >>>          optimizer.zero_grad()
    >>>          loss_fn(model(input), target).backward()
    >>>          optimizer.step()
    >>>      if i > swa_start:
    >>>          swa_scheduler.step()
    >>>      else:
    >>>          scheduler.step()

.. _Averaging Weights Leads to Wider Optima and Better Generalization:
    https://arxiv.org/abs/1803.05407
Ú	optimizerÚswa_lrÚanneal_strategy©ÚcosÚlinearr"   Nc                 ó&  >• [        SX5      n[        XaR                  SS9 H	  u  p'X'S'   M     US;  a  [        SU 35      eU R	                  U5        [        U[        5      (       a  US:  a  [        SU 35      eX0l        [        TU ]%  X5        g )Nr    Tr$   r¢   z>anneal_strategy must by one of 'cos' or 'linear', instead got r   z3anneal_epochs must be equal or greater than 0, got )
r   r*   Úparam_groupsr4   Ú_set_anneal_funcr?   rF   Úanneal_epochsr\   r]   )	re   rŸ   r    r¨   r¡   Ú
last_epochÚswa_lrsÚgrouprf   s	           €r0   r]   ÚSWALR.__init__Õ  s¨   ø€ ô   ¨)Ó<ˆÜ  ×*@Ñ*@ÈÔN‰MˆFØ$�(‹Oñ OàÐ"3Ó3ÜðØ.Ð/ð1óð ð 	×Ñ˜oÔ.Ü˜-¬×-Ñ-°ÀÓ1BÜØEÀmÀ_ÐUóð ð +ÔÜ‰Ñ˜Õ/r3   c                 ó   • U $ ©NrM   ©Úts    r0   Ú_linear_annealÚSWALR._linear_annealí  s   € àˆr3   c                 ó\   • S[         R                  " [         R                  U -  5      -
  S-  $ )Nr   é   )Úmathr£   Úpir¯   s    r0   Ú_cosine_annealÚSWALR._cosine_annealñ  s#   € à”D—H’HœTŸW™W q™[Ó)Ñ)¨QÑ.Ð.r3   c                 ó,   • US:X  a  U$ XU-  -
  SU-
  -  $ rL   rM   )Úlrr    r<   s      r0   Ú_get_initial_lrÚSWALR._get_initial_lrõ  s$   € à�A‹:ØˆMØ˜V‘^Ñ#¨¨E©	Ñ2Ð2r3   c                 óÂ  • U R                   (       d  [        R                  " S[        SS9  U R                  S-
  nU R
                  S:X  a  [        SU5      n[        S[        SUS-
  [        SU R
                  5      -  5      5      nU R                  U5      nU R                  R                   Vs/ s H  nU R                  US   US   U5      PM     nn[        S[        SU[        SU R
                  5      -  5      5      nU R                  U5      n[        U R                  R                  USS	9 VVs/ s H  u  pHUS   U-  USU-
  -  -   PM     snn$ s  snf s  snnf )
a  Compute the next learning rate for each of the optimizer's
:attr:`~torch.optim.Optimizer.param_groups`.

Uses :attr:`anneal_func` to interpolate between each group's
``group["lr"]`` and ``group["swa_lr"]`` over :attr:`anneal_epochs`
epochs. Once :attr:`anneal_epochs` is reached, keeps the learning rate
fixed at ``group["swa_lr"]``.

Returns:
    list[float | Tensor]: A :class:`list` of learning rates for each of
    the optimizer's :attr:`~torch.optim.Optimizer.param_groups` with the
    same types as their current ``group["lr"]``\s.

.. note::
    If you're trying to inspect the most recent learning rate, use
    :meth:`get_last_lr()` instead.

.. note::
    The returned :class:`~torch.Tensor`\s are copies, and never alias
    the optimizer's ``group["lr"]``\s.
zTTo get the last learning rate computed by the scheduler, please use `get_last_lr()`.r´   )Ú
stacklevelr   r   rº   r    Tr$   )Ú_get_lr_called_within_stepÚwarningsÚwarnÚUserWarningÚ_step_countr¨   ÚmaxÚminÚanneal_funcrŸ   r¦   r»   r*   )	re   ÚstepÚprev_tÚ
prev_alphar«   Úprev_lrsr°   r<   rº   s	            r0   Úget_lrÚSWALR.get_lrû  sZ  € ð2 ×.×.Ü�MŠMð.äØò	ð ×Ñ !Ñ#ˆØ×Ñ Ó"Ü�q˜$“<ˆDä�Qœ˜A  q¡¬C°°4×3EÑ3EÓ,FÑFÓGÓHˆØ×%Ñ% fÓ-ˆ
ð Ÿ™×4Ò4ó
â4�ð × Ñ   t¡¨e°H©o¸zÖJÙ4ð 	ð 
ô
 �”3�q˜$¤ Q¨×(:Ñ(:Ó!;Ñ;Ó<Ó=ˆØ× Ñ  Ó#ˆô ! §¡×!<Ñ!<¸hÈtÒTô
âT‘	�ð �(‰O˜eÑ# b¨A°©IÑ&6Ô6ÙTò
ð 	
ùò
ùó
s   Â0#EÄ5Ec                 ób   • Xl         US:X  a  U R                  U l        g U R                  U l        g )Nr£   )Ú_anneal_strategyr·   rÆ   r±   )re   r¡   s     r0   r§   ÚSWALR._set_anneal_func.  s,   € Ø /ÔØ˜eÓ#Ø#×2Ñ2ˆDÕà#×2Ñ2ˆDÕr3   c                 ó|   • U R                   R                  5        VVs0 s H  u  pUS;  d  M  X_M     snn$ s  snnf )z›Return the state of the scheduler as a :class:`dict`.

It contains an entry for every variable in self.__dict__ which
is not the optimizer or anneal_func.
)rŸ   rÆ   )Ú__dict__ru   )re   ÚkeyÚvalues      r0   Ú
state_dictÚSWALR.state_dict5  sE   € ð #Ÿm™m×1Ñ1Ô3ô
â3‘
�ØÐ6Ñ6ó ˆCŠJÙ3ò
ð 	
ùó 
s   ž8®8rÔ   c                 óp   • U R                   R                  U5        U R                  U R                  5        g)z“Load the scheduler's state.

Args:
    state_dict (dict): scheduler state. Should be an object returned
        from a call to :meth:`state_dict`.
N)rÑ   Úupdater§   rÎ   )re   rÔ   s     r0   Úload_state_dictÚSWALR.load_state_dictB  s*   € ð 	�‰×Ñ˜ZÔ(Ø×Ñ˜d×3Ñ3Õ4r3   )rÎ   r¨   rÆ   )é
   r£   éÿÿÿÿ)r…   r†   r‡   rˆ   r‰   r   r=   r   r]   Ústaticmethodr±   r·   r»   r
   rË   r§   ÚdictÚstrr   rÔ   rØ   r‹   rŒ   r�   s   @r0   r   r   ©  sÿ   ø† ñ)ð^ Ø49Øñ0àð0ð ð0ð
 ! Ñ1ð0ð 
÷0ð 0ð0 ñó ðð ñ/ó ð/ð ñ3ó ð3ð
 ñ0
ó ð0
ðd3°¸Ñ0Hð 3ÈTô 3ð ð

˜D  c ™Nó 

ó ð

ð ð5¨$¨s°C¨x©.ð 5¸Tó 5ó ö5r3   r   )g+‡ÙÎ÷ï?r®   )*r‰   rn   rµ   rÀ   Úcollections.abcr   r   Úcopyr   Útypingr   r   r   r	   Útyping_extensionsr
   r&   r   Útorch.nnr   Útorch.optim.lr_schedulerr   r   Útorch.utils._foreach_utilsr   rŸ   r   Ú__all__r   r™   r˜   r6   r   r   r   r   r   r5   rF   rW   r   r   rM   r3   r0   Ú<module>rç      sç   ðá Eã Û Û ß .Ý ß ,Ó ,Ý &ã Ý Ý ß ?Ý Må  ò€õ Jð �5˜ ˜Ñ% t¨F¡|Ð3Ñ4€
ô(òVôDòD	ôK�Fô Kð\ ‡‚ƒð )-ñ7Ø�S‰Mð7àð7ð �%—,‘,Ñ Ñ%ð7ð 
ô	7ó ð7ôtb5ˆKõ b5r3   