+
    ˜°³jVW ã                  óÊ  a € 0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
Ht ^ RI5 ^ RIHt ^ RIt^ RI	Ht ^ RIt^ RIHu Ht ^ RIHt ^ RIHtHt ^ R	IHt ^ R
IHtHt ^ RIH t H!t!H"t"H#t# . RpOt$Rt%]#! R4      t&]"! R4      t'Rs(R])R&   ]PT                  R R l4       t+R R lt,R R lt-RqR lt. ! R R4      t/R t0R  R! lt1R"R/R# R$ llt2RqR% lt3 ! R& R]Ph                  Pj                  4      t6R' t7 ! R( R)4      t8R* t9]!R+RR,R-R.]7R/]%R0R1R2R-R3R/R4 R5 ll4       t:]!RrR+RR,R-R.]7R/]%R0R1R2R-R3R/R6 R7 lll4       t:]Pv                  RrR+RR,R-R.]7R/]%R0R1R2R-R3R/R8 R9 lll4       t:R+RR,R-R.]7R/]%R0R1R2R-R3R/R: R; llt<RrR< lt=R= R> lt>Rs?R])R?&   ]PT                  R@ RA l4       t@ ! RB RC4      tA ! RD RE4      tB ! RF RG4      tCRHtDRItE ! RJ R]F4      tGRK RL ltHRM RN ltI]%]IRORP /tJRQ])RR&    ! RS RT]K4      tLRU tM ! RV RW]Ph                  Pœ                  Pž                  4      tP ! RX RY]P4      tQ]Pv                  RZ 4       tR ! R[ R\]P4      tSR] tT ! R^ R_4      tUR` tV ! Ra R4      tW ! Rb R]P°                  4      tYRc tZ]P¶                  P¸                  Pº                  P¼                  ]P¶                  P¾                  PÀ                  P¼                  0]a! ]PÄ                  PÆ                  PÈ                  PÊ                  4      ,          tfRd tg ! Re Rf]4      th]i! 4       tj]i! 4       tkRgtl ! Rh Ri]4      tmRsRj ltnR-]7]%R1R-3R3R/Rk Rl llltoR,R-R.]7R/]%R0R1R2R-R3R/Rm Rn lltp ! Ro R4      tqR# )té    )ÚannotationsN)Údefaultdict)Ú*)ÚSelf)ÚReferenceType)Útree_map)Úcapture_logsÚLoggingTensorMode)ÚTorchDispatchMode)Ú_make_saved_tensorÚSavedTensor)ÚNoReturnÚoverloadÚ	ParamSpecÚTypeVarÚCheckpointErrorÚCheckpointFunctionÚDefaultDeviceTypeÚCheckpointPolicyÚSelectiveCheckpointContextÚGraphExecGroupÚdefaultÚ_TÚ_Púbool | NoneÚ_checkpoint_debug_enabledc               ó   € V ^8„  d   QhRR/# )é   Úenabledr   © )Úformats   "ÚW/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/utils/checkpoint.pyÚ__annotate__r#   6   s   € ÷ )ñ )¨+ñ )ó    c              #  ó:   "  €  \         pV s Rx € Vs R#   Xs i ; i5i)aÉ  
Context manager that sets whether checkpoint should print additional debug
information when running. See the ``debug`` flag for
:func:`~torch.utils.checkpoint.checkpoint` for more information. Note that
when set, this context manager overrides the value of ``debug`` passed to
checkpoint. To defer to the local setting, pass ``None`` to this context.

Args:
    enabled (bool): Whether checkpoint should print debug information.
        Default is 'None'.
N)r   )r   Úprevs   & r"   Úset_checkpoint_debug_enabledr'   5   s$   é € ð)Ü(ˆØ$+Ð!Ûà$(Ò!ø DÑ!üó   ‚„ �”˜c               ó    € V ^8„  d   QhRRRR/# )r   ÚinputszTuple[Any, ...]ÚreturnzTuple[torch.Tensor, ...]r    )r!   s   "r"   r#   r#   K   s   € ÷ 
ñ 
˜Oð 
Ð0Hñ 
r$   c                óf  € \        V \        4      '       d|   . pV  Fh  p\        V\        P                  4      '       g   VP	                  V4       K6  VP                  4       pVP                  Vn        VP	                  V4       Kj  	  \        V4      # \        R \        V 4      P                   24      h)z@Only tuple of tensors is supported. Got Unsupported input type: )
Ú
isinstanceÚtupleÚtorchÚTensorÚappendÚdetachÚrequires_gradÚRuntimeErrorÚtypeÚ__name__)r*   ÚoutÚinpÚxs   &   r"   Údetach_variabler:   K   s�   € Ü�&œ%× Ò ØˆÛˆCÜ˜c¤5§<¡<×0Ò0Ø—
‘
˜3”Ùà—
‘
“ˆAØ!×/Ñ/ˆAŒOØ�J‰J�qŽMñ ô �S‹zÐäØNÌtÐTZË|×OdÑOdÐNeÐfó
ð 	
r$   c               ó    € V ^8„  d   QhRRRR/# )r   r*   zIterable[Any]r+   ÚNoner    )r!   s   "r"   r#   r#   ]   s   € ÷ 
ñ 
 Mð 
°dñ 
r$   c                ó®   € \         ;QJ d    R  V  4       F  '       g   K   RM	  RM! R  V  4       4      '       g   \        P                  ! R^R7       R# R# )c              3  ó~   "  € T F3  p\        V\        P                  4      '       g   K%  VP                  x € K5  	  R # 5i©N)r-   r/   r0   r3   ©Ú.0r8   s   & r"   Ú	<genexpr>Ú*check_backward_validity.<locals>.<genexpr>^   s&   é € ÐT©F S´jÀÄeÇlÁl×6SÔ ˆs× Ö «Fùs   ‚"=©=TFzBNone of the inputs have requires_grad=True. Gradients will be None©Ú
stacklevelN)ÚanyÚwarningsÚwarn)r*   s   &r"   Úcheck_backward_validityrI   ]   s;   € ß‹3ÑT©FÓT�3�3Š3ÑT©FÓT×TÒTÜ�ŠØPÐ]^÷	
ñ Ur$   c                ó`   € V R 8X  d   \         P                  ! R 4      # \        \         V 4      pV# )Úmeta)r/   ÚdeviceÚgetattr)rL   Údevice_modules   & r"   Ú_get_device_modulerO   d   s+   € Ø�ÔÜ�|Š|˜FÓ#Ð#ÜœE 6Ó*€MØÐr$   c                  óZ   € ] tR t^kt$ RtRtR]R&   ]R
R R ll4       t]R R l4       t	R	t
R# )r   a)  
A class that manages the default device type for checkpointing.

If no non-CPU tensors are present, the default device type will
be used. The default value is 'cuda'. The device type is used in
the checkpointing process when determining which device states
to save and restore for recomputation.
Nz
str | NoneÚ_default_device_typec               ó    € V ^8„  d   QhRRRR/# )r   rL   Ústrr+   r<   r    )r!   s   "r"   r#   ÚDefaultDeviceType.__annotate__x   s   € ÷ 8ñ 8 ð 8°ñ 8r$   c                ó   € V \         n        R# )z‚
Set the default device type for checkpointing.

Args:
    device (str): The device type to be set as default. Default is 'cuda'.
N)r   rQ   )rL   s   &r"   Úset_device_typeÚ!DefaultDeviceType.set_device_typew   s   € ð 28ÔÖ.r$   c               ó   € V ^8„  d   QhRR/# )r   r+   rS   r    )r!   s   "r"   r#   rT   ‚   s   € ÷ 
6ñ 
6˜Sñ 
6r$   c                 óÊ   € \         P                  '       g?   \        P                  P	                  R4      ;p '       d   V P
                  MR\         n        \         P                  # )zl
Get the current default device type for checkpointing.

Returns:
    str: The current default device type.
TÚcpu)r   rQ   r/   ÚacceleratorÚcurrent_acceleratorr5   )Úaccs    r"   Úget_device_typeÚ!DefaultDeviceType.get_device_type�   sL   € ô !×5×5Ð5ÜIN×IZÑIZ×InÑInÐosÓItÐBtÀ#ÖBt°S·X²Xð  |AÔÔ2ä ×5Ñ5Ð5r$   r    ©Úcuda)r6   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rQ   Ú__annotations__ÚstaticmethodrV   r^   Ú__static_attributes__r    r$   r"   r   r   k   s:   ‡ ñð (,Ð˜*Ó+àö8ó ð8ð ô
6ó ô
6r$   c                 ó(  a€ . oV3R  lp\        W4       \        S4      p\        V4      ^8”  d/   \        P                  ! R\        V4       RS^ ,           2^R7       \        S4      ^ 8X  d   \        P                  4       # RV9   d   R# S^ ,          # )c                óÈ   <€ \        V \        P                  4      '       dA   V P                  P                  R 8w  d&   SP                  V P                  P                  4       V # ©rZ   )r-   r/   r0   rL   r5   r1   )ÚargÚdevice_typess   &€r"   Úadd_device_typesÚ,_infer_device_type.<locals>.add_device_types’   s>   ø€ ä�cœ5Ÿ<™<×(Ò(¨S¯Z©Z¯_©_ÀÔ-EØ×Ñ §
¡
§¡Ô0Øˆ
r$   aÌ  Tensor arguments, excluding CPU tensors, are detected on at least two types of devices. Device state will only be saved for devices of a single device type, and the remaining devices will be ignored. Consequently, if any checkpointed functions involve randomness, this may result in incorrect gradients. (Note that if CUDA devices are among the devices detected, it will be prioritized; otherwise, the first device encountered will be selected.)
Device types: z first device type: rD   ra   )r   ÚsetÚlenrG   rH   Úsortedr   r^   )Úargsrn   Údevice_types_setrm   s   *  @r"   Ú_infer_device_typeru   �   sž   ø€ Ø€Lõô
 ÐÔ$ä˜<Ó(ÐÜ
ÐÓ˜qÔ Ü�Šðô
  &Ð&6Ó7Ð8Ð8LÈ\ÐZ[Í_ÐL]ð_ð
 lmõ	
ô ˆ<Ó˜AÔÜ ×0Ñ0Ó2Ð2Ø	Ð#Ô	#Ùà˜A�Ðr$   c               ó   € V ^8„  d   QhRR/# )r   r+   z$Tuple[List[int], List[torch.Tensor]]r    )r!   s   "r"   r#   r#   ²   s   € ÷ -ñ -Ð Dñ -r$   c                 ó  a€ . oV3R  lp\        W4       . p\        \        V !  4      pS FD  pVP                  V4      ;_uu_ 4        VP	                  VP                  4       4       RRR4       KF  	  SV3#   + '       g   i     K]  ; i)c                ó¼   <€ \        V \        P                  4      '       d;   V P                  P                  R9  d    SP                  V P                  4       4       V # )rZ   >   rZ   rK   )r-   r/   r0   rL   r5   r1   Ú
get_device)rl   Úfwd_device_idss   &€r"   Úadd_device_idsÚ)get_device_states.<locals>.add_device_ids·   s=   ø€ ä�cœ5Ÿ<™<×(Ò(¨S¯Z©Z¯_©_ÀOÔ-SØ×!Ñ! #§.¡.Ó"2Ô3Øˆ
r$   N)r   rO   ru   rL   r1   Úget_rng_state)rs   r{   Úfwd_device_statesrN   Ú	device_idrz   s   *    @r"   Úget_device_statesr€   ²   sƒ   ø€ ð €Nõô
 ˆ^Ô"àÐÜ&Ô'9¸4Ñ'@ÓA€MÛ#ˆ	Ø×!Ñ! )×,Õ,Ø×$Ñ$ ]×%@Ñ%@Ó%BÔC÷ -Ñ,ñ $ð Ð,Ð,Ð,÷ -×,Ð,ús   Á A7Á7BÚdevice_typec               ó   € V ^8„  d   QhRR/# ©r   r+   r<   r    )r!   s   "r"   r#   r#   Ç   s   € ÷ /ñ /¸tñ /r$   c               ó  € Vf   \         P                  4       pVR8X  d   R# \        V4      p\        WRR7       F8  w  rEVP	                  V4      ;_uu_ 4        VP                  V4       RRR4       K:  	  R#   + '       g   i     KO  ; i)aŠ  Sets random number generator states for the specified devices.

Args:
    devices: Device ids to set states for.
    states: States to set.
    device_type: ``device_type`` of the devices to set states for. Default
        is the device returned by a call to ``DefaultDeviceType.get_device_type()``,
        which is ``cuda`` if not changed by calling ``DefaultDeviceType::set_device_type()``.
NrK   F©Ústrict)r   r^   rO   ÚziprL   Úset_rng_state)ÚdevicesÚstatesr�   rN   rL   Ústates   &&$   r"   Úset_device_statesrŒ   Ç   sq   € ð ÒÜ'×7Ñ7Ó9ˆØ�fÔÙÜ& {Ó3€MÜ˜W°U×;‰ˆØ×!Ñ! &×)Õ)Ø×'Ñ'¨Ô.÷ *Ñ)ó <ß)×)Ð)ús   ÁA8Á8B	c                ód  € \         P                  P                  V 4      '       dE   R \         P                  ! V 4      R\         P                  ! V 4      R\         P
                  ! 4       /pMRpR \         P                  ! R4      R\         P                  ! R4      R\         P
                  ! 4       /pW3# )r   ÚdtypeÚcache_enabledNrZ   )r/   ÚampÚis_autocast_availableÚis_autocast_enabledÚget_autocast_dtypeÚis_autocast_cache_enabled)r�   Údevice_autocast_kwargsÚcpu_autocast_kwargss   &  r"   Ú_get_autocast_kwargsr—   Û   s˜   € Ü‡y�y×&Ñ& {×3Ò3à”u×0Ò0°Ó=Ø”U×-Ò-¨kÓ:ØœU×<Ò<Ó>ð"
Ñð "&Ðð 	”5×,Ò,¨UÓ3Ø”×)Ò)¨%Ó0Øœ×8Ò8Ó:ðÐð "Ð6Ð6r$   c                  ó6   € ] tR t^ît]R 4       t]R 4       tRtR# )r   c                	óX  € \        V4       Wn        W n        \        V!  V n        \        V P                  4      w  V n        V n        V'       dg   \        P                  ! 4       V n
        R V n        \        V P                  4      p\        VRR 4      '       d   RV n        \        V!  w  V n        V n        . V n        . V n        . p\'        V4       F…  w  rg\        P(                  ! V4      '       dJ   VP+                  V4       V P$                  P+                  V4       V P"                  P+                  R4       Kj  V P"                  P+                  V4       K‡  	  V P,                  ! V!   \        P.                  ! 4       ;_uu_ 4        V! V!  pRRR4       V#   + '       g   i     X# ; i)FÚ_initializedTN)rI   Úrun_functionÚpreserve_rng_stateru   r�   r—   r•   r–   r/   r}   Úfwd_cpu_stateÚhad_device_in_fwdrO   rM   r€   Úfwd_devicesr~   r*   Útensor_indicesÚ	enumerateÚ	is_tensorr1   Úsave_for_backwardÚno_grad)	Úctxr›   rœ   rs   rN   Útensor_inputsÚirl   Úoutputss	   &&&*     r"   ÚforwardÚCheckpointFunction.forwardï   sP  € ô 	  Ô%Ø'ÔØ!3Ôä,¨dÑ3ˆŒÜ>RØ�O‰Oó?
Ñ;ˆÔ" CÔ$;÷ Ü %× 3Ò 3Ó 5ˆCÔð
 %*ˆCÔ!Ü.¨s¯©Ó?ˆMÜ�} n°e×<Ò<Ø(,�Ô%Ü9JÈDÑ9QÑ6�” Ô!6ð ˆŒ
ØˆÔØˆÜ –o‰FˆAÜ�Š˜s×#Ò#Ø×$Ñ$ SÔ)Ø×"Ñ"×)Ñ)¨!Ô,Ø—
‘
×!Ñ! $Ö'à—
‘
×!Ñ! #Ö&ñ &ð 	×Ò˜}Ò-ä�]Š]�_�_Ù" DÑ)ˆG÷ àˆ÷ Ž_àˆús   ÆFÆF)	c                	óÄ  € \         P                  P                  4       '       g   \        R 4      h\	        V P
                  4      pV P                  pV P                  p\        V4       F  w  rVWE,          W&&   K  	  . pV P                  '       d   V P                  '       d   V P                  p\         P                  P                  WpP                  V P                  R7      ;_uu_ 4        V P                  '       d_   \         P                  ! V P                   4       V P                  '       d-   \#        V P                  V P$                  V P                  R7       \'        \)        V4      4      p\         P*                  P-                  V P                  4      '       d7   \         P*                  P.                  ! RRV P                  /V P0                  B M\2        P4                  ! 4       p	\         P6                  ! 4       ;_uu_ 4        T	;_uu_ 4        \         P*                  P.                  ! R/ V P8                  B ;_uu_ 4        V P:                  ! V!  p
RRR4       RRR4       RRR4       RRR4       \=        X
\         P>                  4      '       d   V
3p
. p. p\A        \C        V
4      4       Fo  p\         PD                  ! W¥,          4      '       g   K'  W¥,          PF                  '       g   KA  VPI                  W¥,          4       VPI                  W,          4       Kq  	  \C        V4      ^ 8X  d   \        R4      h\         P                  PK                  W¼4       \(        ;QJ d    . R X 4       F  NK  	  5M! R X 4       4      pR	V,           #   + '       g   i     ELF; i  + '       g   i     ELR; i  + '       g   i     EL^; i  + '       g   i     ELj; i)
z÷When use_reentrant=True, torch.utils.checkpoint is incompatible with .grad() or passing an `inputs` parameter to .backward(). To resolve this error, you can either set use_reentrant=False, or call .backward() without passing the `inputs` argument.©r‰   r   r�   ©r�   r�   NzInone of output has requires_grad=True, this checkpoint() is not necessaryc              3  ó~   "  € T F3  p\        V\        P                  4      '       d   VP                  MR x € K5  	  R # 5ir?   )r-   r/   r0   Úgradr@   s   & r"   rB   Ú.CheckpointFunction.backward.<locals>.<genexpr>P  s0   é € ð 
á&�ô # 3¬¯©×5Ò5ˆC�HŠH¸4Ô?Û&ùs   ‚;=r    rk   )NN)&r/   ÚautogradÚ_is_checkpoint_validr4   Úlistr*   r    Úsaved_tensorsr¡   rœ   rž   rŸ   ÚrandomÚfork_rngr�   rˆ   r�   rŒ   r~   r:   r.   r�   r‘   Úautocastr•   Ú
contextlibÚnullcontextÚenable_gradr–   r›   r-   r0   Úrangerq   r¢   r3   r1   Úbackward)r¥   rs   r*   r    Útensorsr§   ÚidxÚrng_devicesÚdetached_inputsÚdevice_autocast_ctxr¨   Úoutputs_with_gradÚargs_with_gradÚgradss   &*            r"   r¼   ÚCheckpointFunction.backward  sÜ  € ä�~‰~×2Ñ2×4Ò4ÜðNóð ô �c—j‘jÓ!ˆØ×+Ñ+ˆØ×#Ñ#ˆô   Ö/‰FˆAØ!�*ˆF‹Kñ 0ð ˆØ×!×!Ð! c×&;×&;Ð&;ØŸ/™/ˆKÜ�\‰\×"Ñ"Ø×)?Ñ)?ÈSÏ_É_ð #÷ 
õ 
ð ×%×%Ð%Ü×#Ò# C×$5Ñ$5Ô6Ø×(×(Ð(Ü% c§o¡o°s×7LÑ7LÐZ]×ZiÑZiÕjÜ-¬e°F«mÓ<ˆOô —‘×0Ñ0°·±×AÒAô #(§)¡)×"4Ò"4ñ #ØŸO™Oð#Ø/2×/IÑ/Iò#äGQ×G]ÒG]ÓG_ð  ô ×"Ò"×$Õ$×&9Ò&9¼5¿9¹9×;MÒ;MÑ;oÐWZ×WnÑWn×;oÓ;oØ×*Ò*¨OÑ<�÷ <p×&9×$÷
ô �gœuŸ|™|×,Ò,Ø�jˆGð ÐØˆÜ”s˜7“|Ö$ˆAÜ�Š˜w�z×*Ô*¨w­z×/G×/GÒ/GØ!×(Ñ(¨­Ô4Ø×%Ñ% d¥gÖ.ñ %ô Ð Ó! QÔ&Üð6óð ô 	�‰×ÑÐ 1ÔBß”ñ 
á&ó
—‘ñ 
á&ó
ó 
ˆð
 ˜eÕ#Ð#÷1 <p×;oÐ;oú×&9×&9Ð&9ú×$×$Ð$ú÷
÷ 
ð 
ús\   Ã*AOÄ/COÈN:	È3N&ÉNÉN&ÉN:	É%OÎN#Î	N&Î&N7Î1	N:	Î:OÏ	OÏO	r    N)r6   rb   rc   rd   rg   r©   r¼   rh   r    r$   r"   r   r   î   s)   † Øñ&ó ð&ðP ñ;$ó ô;$r$   c                 óV   € \         P                  ! 4       \         P                  ! 4       3# r?   )r¸   r¹   r    r$   r"   Únoop_context_fnrÇ   X  s   € Ü×!Ò!Ó#¤Z×%;Ò%;Ó%=Ð=Ð=r$   c                  ó,   € ] tR tRtR tR tRR ltRtR# )Ú_CheckpointedFunctioni\  c                	ób   € Wn         \        V4      V n        \        P                  ! WRR 7       R# ))ÚupdatedNr    )ÚfunctionÚdictÚcheckpoint_kwargsÚ	functoolsÚupdate_wrapper)ÚselfrÌ   rÎ   s   &&,r"   Ú__init__Ú_CheckpointedFunction.__init__]  s%   € Ø ŒÜ!%Ð&7Ó!8ˆÔÜ× Ò  ¸×<r$   c                	óF   € \        V P                  VV3/ V P                  B # r?   )Ú_checkpoint_implrÌ   rÎ   )rÑ   rs   Úkwargss   &*,r"   Ú__call__Ú_CheckpointedFunction.__call__b  s,   € ÜØ�M‰MØØñ
ð ×$Ñ$ñ	
ð 	
r$   Nc                	óŒ   € Vf   V # \        V P                  RR 4      pVf   V # \        V 4      ! V! W4      3/ V P                  B # )NÚ__get__)rM   rÌ   r5   rÎ   )rÑ   ÚinstanceÚownerÚdescriptor_gets   &&& r"   rÚ   Ú_CheckpointedFunction.__get__j  sS   € ð
 ÒØˆKÜ  §¡°	¸4Ó@ˆØÒ!ØˆKÜ�DŒzÙ˜8Ó+ñ
à×$Ñ$ñ
ð 	
r$   )rÎ   rÌ   r?   )r6   rb   rc   rd   rÒ   r×   rÚ   rh   r    r$   r"   rÉ   rÉ   \  s   † ò=ò

÷
ð 
r$   rÉ   c                ó   € \        V 3/ VB # r?   )rÉ   )rÌ   rÎ   s   &,r"   Ú_make_checkpoint_wrapperrà   z  s   € Ü  Ñ?Ð->Ñ?Ð?r$   Úuse_reentrantrœ   TÚ
context_fnÚdeterminism_checkÚdebugFÚ
early_stopÚrespect_saved_tensors_hooksc               óD   € V ^8„  d   QhRRRRRRRRR	R
RRRRRRRRRRRR/# )r   rÌ   zCallable[..., _T]rs   ÚAnyrá   r   rœ   Úboolrâ   ú3Callable[[], Tuple[ContextManager, ContextManager]]rã   rS   rä   rå   ræ   rÖ   r+   r   r    )r!   s   "r"   r#   r#     sw   € ÷ ñ Øðàðð ðð ð	ð
 Dðð ðð ðð ðð "-ðð ðð ñr$   c               ó   € R # r?   r    ©
rÌ   rá   rœ   râ   rã   rä   rå   ræ   rs   rÖ   s
   &$$$$$$$*,r"   Ú
checkpointrí   ~  s   € ñ 
r$   c               ó<   € V ^8„  d   QhRRRRRRRRR	R
RRRRRRRR/	# )r   rÌ   r<   rá   r   rœ   ré   râ   rê   rã   rS   rä   rå   ræ   r+   z.Callable[[Callable[_P, _T]], Callable[_P, _T]]r    )r!   s   "r"   r#   r#   Ž  se   € ÷ 
9ñ 
9Øð
9ð ð
9ð ð	
9ð
 Dð
9ð ð
9ð ð
9ð ð
9ð "-ð
9ð 4ñ
9r$   c               ó   € R # r?   r    )rÌ   rá   rœ   râ   rã   rä   rå   ræ   s   &$$$$$$$r"   rí   rí   �  s   € ñ 69r$   c               ó4   € V ^8„  d   QhRRRRRRRRR	RR
RRR/# ©r   rá   r   rœ   ré   râ   rê   rã   rS   rä   rå   ræ   r    )r!   s   "r"   r#   r#   §  s\   € ÷ Bñ Bð ðBð ð	Bð
 DðBð ðBð ðBð ðBð "-ñBr$   c               óè   € V f[   V'       gS   V	'       d)   \        RRP                  R V	 4       4      ,           4      h\        P                  ! \        VVVVVVVR7      # \        V VV	VVVVVVVR7
      # )a6   Checkpoint a model or part of the model.

Activation checkpointing is a technique that trades compute for memory.
By default, tensors computed during the forward pass are kept alive until
they are used in gradient computations in the backward pass. To reduce this
memory usage, tensors produced in the passed :attr:`function` are not kept
alive until the backward pass. Instead, any passed tensors in :attr:`args`
are kept alive, and the unsaved tensors are recomputed by re-invoking
:attr:`function` in the backward pass as needed for gradient computation.
Activation checkpointing can be applied to any part of a model -- this is
sometimes described as "checkpointing" that part of the model.

There are currently two checkpointing implementations available, determined
by the :attr:`use_reentrant` parameter. It is recommended that you use
``use_reentrant=False``. Please refer the note below for a discussion of
their differences.

.. warning::

    If the :attr:`function` invocation during the backward pass differs
    from the forward pass, e.g., due to a global variable, the checkpointed
    version may not be equivalent, potentially causing an
    error being raised or leading to silently incorrect gradients.

.. warning::

    The ``use_reentrant`` parameter should be passed explicitly. In version
    2.9 we will raise an exception if ``use_reentrant`` is not passed.
    If you are using the ``use_reentrant=True`` variant, please refer to the
    note below for important considerations and potential limitations.

.. note::

    The reentrant variant of checkpoint (``use_reentrant=True``) and
    the non-reentrant variant of checkpoint (``use_reentrant=False``)
    differ in the following ways:

    * Non-reentrant checkpoint stops recomputation as soon as all needed
      intermediate activations have been recomputed. This feature is enabled
      by default, but can be disabled with :func:`set_checkpoint_early_stop`.
      Reentrant checkpoint always recomputes :attr:`function` in its
      entirety during the backward pass.

    * The reentrant variant does not record the autograd graph during the
      forward pass, as it runs with the forward pass under
      :func:`torch.no_grad`. The non-reentrant version does record the
      autograd graph, allowing one to perform backward on the graph within
      checkpointed regions.

    * The reentrant checkpoint only supports the
      :func:`torch.autograd.backward` API for the backward pass without its
      `inputs` argument, while the non-reentrant version supports all ways
      of performing the backward pass.

    * At least one input and output must have ``requires_grad=True`` for the
      reentrant variant. If this condition is unmet, the checkpointed part
      of the model will not have gradients. The non-reentrant version does
      not have this requirement.

    * The reentrant version does not consider tensors in nested structures
      (e.g., custom objects, lists, dicts, etc) as participating in
      autograd, while the non-reentrant version does.

    * The reentrant checkpoint does not support checkpointed regions with
      detached tensors from the computational graph, whereas the
      non-reentrant version does. For the reentrant variant, if the
      checkpointed segment contains tensors detached using ``detach()`` or
      with :func:`torch.no_grad`, the backward pass will raise an error.
      This is because ``checkpoint`` makes all the outputs require gradients
      and this causes issues when a tensor is defined to have no gradient in
      the model. To avoid this, detach the tensors outside of the
      ``checkpoint`` function.

Args:
    function: describes what to run in the forward pass of the model or
        part of the model. It should also know how to handle the inputs
        passed as the tuple. For example, in LSTM, if user passes
        ``(activation, hidden)``, :attr:`function` should correctly use the
        first input as ``activation`` and the second input as ``hidden``.
        If omitted, ``checkpoint`` returns a decorator that can be used to
        wrap a function before passing user arguments.
    args: tuple containing inputs to the :attr:`function`

Keyword args:
    preserve_rng_state(bool, optional):  Omit stashing and restoring
        the RNG state during each checkpoint. Note that under torch.compile,
        this flag doesn't take effect and we always preserve RNG state.
        Default: ``True``
    use_reentrant(bool):
        specify whether to use the activation checkpoint variant that
        requires reentrant autograd. This parameter should be passed
        explicitly. In version 2.9 we will raise an exception if
        ``use_reentrant`` is not passed. If ``use_reentrant=False``,
        ``checkpoint`` will use an implementation that does not require
        reentrant autograd. This allows ``checkpoint`` to support additional
        functionality, such as working as expected with
        ``torch.autograd.grad`` and support for keyword arguments input into
        the checkpointed function.
    context_fn(Callable, optional): A callable returning a tuple of two
        context managers. The function and its recomputation will be run
        under the first and second context managers respectively.
        This argument is only supported if ``use_reentrant=False``.
    determinism_check(str, optional): A string specifying the determinism
        check to perform. By default it is set to ``"default"`` which
        compares the shapes, dtypes, and devices of the recomputed tensors
        against those the saved tensors. To turn off this check, specify
        ``"none"``. Currently these are the only two supported values.
        Please open an issue if you would like to see more determinism
        checks. This argument is only supported if ``use_reentrant=False``,
        if ``use_reentrant=True``, the determinism check is always disabled.
    debug(bool, optional): If ``True``, error messages will also include
        a trace of the operators ran during the original forward computation
        as well as the recomputation. This argument is only supported if
        ``use_reentrant=False``.
    early_stop(bool, optional): If ``True``, non-reentrant checkpoint stops
        recomputation as soon as it has computed all needed Tensors. This
        argument is ignored if ``use_reentrant=True``. Can be overridden
        globally using :func:`set_checkpoint_early_stop` context manager.
        Default: ``True``.
    respect_saved_tensors_hooks(bool, optional): Whether tensors that
        selective activation checkpointing (SAC) saves are routed through
        the surrounding user
        :func:`torch.autograd.graph.saved_tensors_hooks` (e.g.
        :func:`torch.autograd.graph.save_on_cpu`). Such tensors are held
        outside the autograd graph, so historically these hooks did not see
        them; a future release will make checkpoint honor the hooks by
        default. Until then the default (``None``) keeps the legacy behavior
        and emits a ``FutureWarning`` when a user hook is in scope; pass
        ``True`` to opt in or ``False`` to keep the legacy behavior without
        the warning. Has no effect without SAC (plain checkpoint recomputes
        rather than saves) or when ``use_reentrant=True``. This argument is
        only supported if ``use_reentrant=False``.

Returns:
    Output of running :attr:`function` on :attr:`*args`, or a decorator
    when :attr:`function` is omitted.

Example:
    >>> # xdoctest: +SKIP("stub")
    >>> # Direct call: checkpoint the function immediately.
    >>> out = torch.utils.checkpoint.checkpoint(
    ...     fn, *args, use_reentrant=False, **kwargs
    ... )
    >>> # Decorator/curried form: configure once, then call.
    >>> checkpointed_fn = torch.utils.checkpoint.checkpoint(
    ...     use_reentrant=False,
    ...     preserve_rng_state=False,
    ... )(fn)
    >>> out = checkpointed_fn(*args, **kwargs)
    >>> # The same decorator can be applied directly to a function or method.
    >>> @torch.utils.checkpoint.checkpoint(use_reentrant=False)
    ... def fn(*args, **kwargs):
    ...     ...
    >>> out = fn(*args, **kwargs)
úUnexpected keyword arguments: Ú,c              3  ó$   "  € T F  qx € K  	  R # 5ir?   r    ©rA   rl   s   & r"   rB   Úcheckpoint.<locals>.<genexpr>Q  s   é € Ð;RÉ6ÀC¼CË6ùó   ‚)rá   rœ   râ   rã   rä   rå   ræ   )Ú
ValueErrorÚjoinrÏ   Úpartialrà   rÕ   rì   s
   &$$$$$$$*,r"   rí   rí   ¦  sŽ   € ðP Ò§ßÜØ0°3·8±8Ñ;RÉ6Ó;RÓ3RÕRóð ô × Ò Ü$Ø'Ø1Ø!Ø/ØØ!Ø(Cô	
ð 		
ô ØØØØ#Ø-ØØ+ØØØ$?ôð r$   c               ó4   € V ^8„  d   QhRRRRRRRRR	RR
RRR/# rñ   r    )r!   s   "r"   r#   r#   l  s\   € ÷ N
ñ N
ð
 ðN
ð ðN
ð DðN
ð ðN
ð ðN
ð ðN
ð "-ñN
r$   c               ó^  € Tp
Vf   \         P                  ! R^R7       RpV'       d1   V'       d)   \        RRP                  R V 4       4      ,           4      hV'       d8   V\        Jg   VRJg   V	e   \        R4      h\
        P                  ! W
.VO5!  # \        V VVV
VVVVV	R	7	      p\        V4        V ! V/ VB p \        T4       \        R4      h  \         d8   p TP                  T4       h   \         d   p\        R
4      ThR p?ii ; iR p?ii ; i  \         d    Tu # i ; i)Nav  torch.utils.checkpoint: the use_reentrant parameter should be passed explicitly. Starting in PyTorch 2.9, calling checkpoint without use_reentrant will raise an exception. use_reentrant=False is recommended, but if you need to preserve the current default behavior, you can pass use_reentrant=True. Refer to docs for more details on the differences between the two variants.rD   Tró   rô   c              3  ó$   "  € T F  qx € K  	  R # 5ir?   r    rö   s   & r"   rB   Ú#_checkpoint_impl.<locals>.<genexpr>‰  ó   é € Ð7NÁvÀ¼Ãvùrø   FzkPassing `context_fn`, `debug`, or `respect_saved_tensors_hooks` is only supported when use_reentrant=False.©rœ   râ   rã   rä   rå   ræ   ú×torch.utils.checkpoint: the forward context provided by context_fn suppressed an exception raised during the checkpointed forward. This is not supported because checkpoint cannot return a value for a failed forward.zmtorch.utils.checkpoint: expected context_fn generator to yield exactly twice, but it yielded more than twice.)rG   rH   rù   rú   rÇ   r   ÚapplyÚ,_checkpoint_without_reentrant_generator_implÚnextÚBaseExceptionÚthrowÚStopIterationr4   ÚAssertionError)rÌ   rs   rÖ   rá   rœ   râ   rã   rä   rå   ræ   ÚpreserveÚgenÚretÚeÚstops   &&&$$$$$$$     r"   rÕ   rÕ   l  sb  € ð "€HàÒÜ�ŠðCð õ	
ð ˆç—-ÜØ,¨s¯x©xÑ7NÁvÓ7NÓ/NÕNó
ð 	
÷ àœoÓ-Ø˜EÓ!Ø*Ò6äð>óð ô "×'Ò'¨ÐB¸TÓBÐBä:ØØØØ'Ø!Ø/ØØ!Ø(Cô

ˆô 	ˆSŒ	ð	Ù˜DÐ+ FÑ+ˆCð	Ü�ŒIô ð=ó
ð 	
øô! ô 
	ðØ—	‘	˜!”ð øô !ô Ü"ðMóð
 ðûðþð
	ûô ô 	ØŠJð	úsH   Â8C ÃD ÃDÃ#C5Ã4DÃ5DÄ DÄDÄDÄDÄD,Ä+D,c                óP  € Vf   \         P                  ! R^R7       RpVP                  RR4      pV'       d)   \        RRP	                  R V 4       4      ,           4      hR p\        V \        P                  P                  4      '       d   \        V P                  4       4      p \        V 4      V,          pR
p\        ^ Wq^,
          ,          V4       F(  p	W—,           ^,
          p\        V! W˜V 4      VVVR	7      pK*  	  V! V^,           \        V 4      ^,
          V 4      ! V4      # )a  Checkpoint a sequential model to save memory.

Sequential models execute a list of modules/functions in order
(sequentially). Therefore, we can divide such a model in various segments
and checkpoint each segment. All segments except the last will not store
the intermediate activations. The inputs of each checkpointed segment will
be saved for re-running the segment in the backward pass.

.. warning::
    The ``use_reentrant`` parameter should be passed explicitly. In version
    2.9 we will raise an exception if ``use_reentrant`` is not passed.
    If you are using the ``use_reentrant=True` variant, please see
    :func:`~torch.utils.checkpoint.checkpoint` for
    the important considerations and limitations of this variant. It is
    recommended that you use ``use_reentrant=False``.

.. warning:
    Since PyTorch 1.4, it allows only one Tensor as the input and
    intermediate outputs, just like :class:`torch.nn.Sequential`.

Args:
    functions: A :class:`torch.nn.Sequential` or the list of modules or
        functions (comprising the model) to run sequentially.
    segments: Number of chunks to create in the model
    input: A Tensor that is input to :attr:`functions`
    preserve_rng_state(bool, optional):  Omit stashing and restoring
        the RNG state during each checkpoint.
        Default: ``True``
    use_reentrant(bool):
        specify whether to use the activation checkpoint variant that
        requires reentrant autograd. This parameter should be passed
        explicitly. In version 2.5 we will raise an exception if
        ``use_reentrant`` is not passed. If ``use_reentrant=False``,
        ``checkpoint`` will use an implementation that does not require
        reentrant autograd. This allows ``checkpoint`` to support additional
        functionality, such as working as expected with
        ``torch.autograd.grad`` and support for keyword arguments input into
        the checkpointed function.

Returns:
    Output of running :attr:`functions` sequentially on :attr:`*inputs`

Example:
    >>> # xdoctest: +SKIP("stub")
    >>> model = nn.Sequential(...)
    >>> input_var = checkpoint_sequential(model, chunks, input_var)
a{  torch.utils.checkpoint.checkpoint_sequential: the use_reentrant parameter should be passed explicitly. In version 2.9 we will raise an exception if use_reentrant is not passed. use_reentrant=False is recommended, but if you need to preserve the current default behavior, you can pass use_reentrant=True. Refer to docs for more details on the differences between the two variants.rD   Trœ   ró   rô   c              3  ó$   "  € T F  qx € K  	  R # 5ir?   r    rö   s   & r"   rB   Ú(checkpoint_sequential.<locals>.<genexpr>ý  r   rø   c                ó   a aa€ VVV 3R  lpV# )c                óZ   <€ \        SS^,           4       F  pSV,          ! V 4      p K  	  V # )é   )r»   )ÚinputÚjÚendÚ	functionsÚstarts   & €€€r"   r©   Ú<checkpoint_sequential.<locals>.run_function.<locals>.forward  s+   ø€ Ü˜5 #¨¥'Ö*�Ø! !ž UÓ+’ñ +àˆLr$   r    )r  r  r  r©   s   fff r"   r›   Ú+checkpoint_sequential.<locals>.run_function   s   ú€ ÷	ð
 ˆr$   )rá   rœ   éÿÿÿÿ)rG   rH   Úpoprù   rú   r-   r/   ÚnnÚ
Sequentialr³   Úchildrenrq   r»   rí   )
r  Úsegmentsr  rá   rÖ   r
  r›   Úsegment_sizer  r  s
   &&&&,     r"   Úcheckpoint_sequentialr#  ½  s  € ð` ÒÜ�ŠðCð PQõ	
ð ˆð �z‰zÐ.°Ó5€HßÜØ,¨s¯x©xÑ7NÁvÓ7NÓ/NÕNó
ð 	
òô �)œUŸX™X×0Ñ0×1Ò1Ü˜×+Ñ+Ó-Ó.ˆ	ä�y“> XÕ-€Là
€CÜ�q˜,°Q­,Õ7¸ÖFˆØÕ" QÕ&ˆÜÙ˜ YÓ/ØØ'Ø'ô	
Šñ Gñ ˜˜a�¤ Y£°!Õ!3°YÔ?ÀÓFÐFr$   c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   r#     s   € ÷ 
ñ 
˜dñ 
r$   c                ó,   € V '       g   \        R 4      hR# )zqSomething went unexpectedly wrong in activation checkpoint. Please report this bug by filing an issue to PyTorch.N)r	  )Úconds   &r"   Ú_internal_assertr'    s   € ßÜðDó
ð 	
ñ r$   Ú_enable_checkpoint_early_stopc               ó   € V ^8„  d   QhRR/# )r   Úenableré   r    )r!   s   "r"   r#   r#   ¨  s   € ÷ -ñ - dñ -r$   c              #  ó:   "  €  \         pV s Rx € Vs R#   Xs i ; i5i)aü  Controls whether checkpoint should stop recomputation early.

By default, non-reentrant checkpoint stops recomputation as soon as it
has computed all needed Tensors. This context manager can be used to disable
that feature if it is problematic for your specific application.

This context manager only needs to be active when forward is run. It does
not need to be active during backward.

Example::

    >>> # xdoctest: +SKIP(failing)
    >>> message = "saved tensors default hooks are disabled"
    >>> with set_checkpoint_early_stop(False):
    ...     # Any checkpoint under this context manager will respect this
    ...     # context manager, even if its backward is performed outside.
    ...     out = checkpoint(fn, inputs)
    ...
    >>> out.backward()
N)r(  )r*  r&   s   & r"   Úset_checkpoint_early_stopr,  §  s$   é € ð.-Ü,ˆØ(.Ð%Ûà(,Ò%ø¨Ñ%ür(   c                  ó   € ] tR tRtRtR# )Ú_HandleiÆ  r    N©r6   rb   rc   rd   rh   r    r$   r"   r.  r.  Æ  ó   † Ûr$   r.  c                  ó"   € ] tR tRtR R ltRtR# )Ú_HolderiÊ  c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú_Holder.__annotate__Ë  s   € ÷ 5ñ 5˜$ñ 5r$   c                	ó   € / V n         R # r?   ©Úhandles©rÑ   s   &r"   rÒ   Ú_Holder.__init__Ë  s	   € Ø24ˆŽr$   r6  N)r6   rb   rc   rd   rÒ   rh   r    r$   r"   r2  r2  Ê  s   † ÷5ñ 5r$   r2  c                  ó:   € ] tR tRtR R ltR tR tR R ltRtR	# )
Ú_CheckpointFrameiÏ  c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú_CheckpointFrame.__annotate__Ð  s   € ÷ +ñ +ÐRVñ +r$   c                	ó  € Wn         . V n        . V n        \        \        P
                  4      V n        \        \        4      V n        \        \        4      V n
        W n        W@n        W0n        . V n        R V n        R V n        R# ©FN)Úrecompute_fnÚ
saved_argsÚweak_holdersr   ÚweakrefÚWeakKeyDictionaryÚ
recomputedÚintÚrecomp_counterré   Úis_recomputedrå   Úmetadata_fnÚunpack_error_cbÚx_metadatasÚforward_completedÚignore_saved_mismatch)rÑ   r@  rå   rJ  rI  s   &&&&&r"   rÒ   Ú_CheckpointFrame.__init__Ð  sx   € Ø(ÔØ%'ˆŒØ13ˆÔô œ×1Ñ1Ó2ð 	Œô
 6AÄÓ5EˆÔÜ5@ÄÓ5FˆÔð %Œð 'ÔØ.ÔØˆÔØ!&ˆÔØ%*ˆÖ"r$   c                	ó˜   € V Uu. uF2  p\        V\        P                  4      '       d   \        VR R7      MTNK4  	  upV n        R# u upi )F)Ú	is_outputN)r-   r/   r0   r   rA  )rÑ   rs   rl   s   &* r"   Úsave_inputsÚ_CheckpointFrame.save_inputsé  sL   € ñ ó
ñ �ô ˜#œuŸ|™|×,Ò,ô ˜s¨eÕ4Ø25ò6áñ
ˆŽùò 
s   …8Ac                	ó�   € V P                    Uu. uF+  p\        V\        4      '       d   VP                  4       MTNK-  	  up# u upi r?   )rA  r-   r   Úunpack)rÑ   rl   s   & r"   Ú
get_inputsÚ_CheckpointFrame.get_inputsð  sD   € ð —’ó
á&�ô ' s¬K×8Ò8ˆC�J‰JŒL¸cÒAÙ&ñ
ð 	
ùò 
s   �1Ac               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   r=  ö  s   € ÷ Dñ D°Tñ Dr$   c           	     	óš  € V P                   '       d   R # \        V P                  4      V P                  V,          8X  g=   \	        R\        V P                  4       RV P                  V,           R\
         24      h. p\        V P                  4       Fî  w  r4V! 4       pVf   K  \        WP                  9   4       \        VP                  V,          R J4       \        VP                  V,          V P                  V,          9   4       V P                  V,          pV P                  V,          VP                  V,          ,          pW`P                  V4      8w  g   KÌ  VP                  W6V P                  V4      34       Kð  	  \        V4      ^ 8”  d7   RpV F  w  r6p	VRV RV RV	 R2,          pK  	  \	        R	V R\
         24      hR # )
Nz—torch.utils.checkpoint: A different number of tensors was saved during the original forward and recomputation.
Number of tensors saved during forward: z/
Number of tensors saved during recomputation: z.
Ú ztensor at position z:
saved metadata: z
recomputed metadata: Ú
zztorch.utils.checkpoint: Recomputed values for the following tensors have different metadata than during the forward pass.
)rM  rq   rB  rG  r   Ú_debug_tip_msgr¡   r'  r7  rE  rK  rI  r1   )
rÑ   ÚgidÚnb_meta_differentr¾   Úweak_holderÚholderÚx_metaÚrecomputed_xÚmismatched_tensorsÚrecomputed_metas
   &&        r"   Úcheck_recomputed_tensors_matchÚ/_CheckpointFrame.check_recomputed_tensors_matchö  sÓ  € Ø×%×%Ð%ñ ô �4×$Ñ$Ó%¨×)<Ñ)<¸SÕ)AÔAô "ð;ä;>¸t×?PÑ?PÓ;QÐ:Rð SAØAE×ATÑATÐUXÕAYÐ@ZÐZ]Ü!Ð"ð	$óð ð ÐÜ )¨$×*;Ñ*;Ö <ÑˆCÙ “]ˆFØŠ~Ùô
 ˜S§N¡NÑ2Ô3ô ˜VŸ^™^¨CÕ0¸Ð<Ô=ä˜VŸ^™^¨CÕ0°D·O±OÀCÕ4HÑHÔIà×%Ñ% cÕ*ˆFØŸ?™?¨3Õ/°·±¸sÕ0CÕDˆLØ×)Ñ)¨,Ó7Ö7Ø!×(Ñ(¨#°t×7GÑ7GÈÓ7UÐ)VÖWñ% !=ô( Ð Ó! AÔ%Ø!#ÐÛ0AÑ,�˜_Ø"Ø)¨#¨ð /'Ø'- hð /,Ø,;Ð+<¸Bð@õÒ"ñ 1Bô "ðJà%Ð& cÜ!Ð"ð$óð ñ &r$   )rå   rL  rM  rH  rI  rG  r@  rE  rA  rJ  rB  rK  N)	r6   rb   rc   rd   rÒ   rQ  rU  rd  rh   r    r$   r"   r;  r;  Ï  s   † õ+ò2
ò
÷Dñ Dr$   r;  u›  
Tip: To see a more detailed error message, either pass `debug=True` to
`torch.utils.checkpoint.checkpoint(...)` or wrap the code block
with `with torch.utils.checkpoint.set_checkpoint_debug_enabled(True):` to
enable checkpointâ€‘debug mode globally.

If this error occurs under torch.compile with automatic_dynamic_shapes enabled,
it may be because the recomputation selected a different compiled graph than the
forward pass (e.g., a dynamic graph instead of the original static graph).
To fix this, either:
  - Use torch._dynamo.mark_dynamic() to explicitly mark varying dimensions as
    dynamic upfront, avoiding the static-to-dynamic transition.
  - Call torch._C._dynamo.eval_frame._set_lru_cache(False) to disable LRU cache
    reordering, which can change which graph is checked first between forward
    and recompute.
See https://github.com/pytorch/pytorch/issues/166926 for more details and
workaround examples.
a±
   An error happened while unpacking tensors; dumping logs of latest computation
because you passed `debug=True` to `torch.utils.checkpoint.checkpoint()`.
Scroll all the way down for guidance on how to navigate these logs.

+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|        1. Stack traces of the operators that ran in the original forward     |
+------------------------------------------------------------------------------+

{forward_traces}
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|        2. Stack traces of the operators that ran during recomputation        |
+------------------------------------------------------------------------------+

{recompute_traces}
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
|       3. Log of operators in the original forward and recomputation          |
+------------------------------------------------------------------------------+
(Scroll up to correlate stack traces with each operation listed below. This
 helps identify their source in the code.)

IMPORTANT: Differences in "detach" calls between the original forward and the
           recomputation are expected. They are introduced by the checkpointing
           mechanism and can be ignored.

Operations executed during the original forward:

{forward_ops}

Operations executed during recomputation:

{recompute_ops}

+------------------------------------------------------------------------------+
 ERROR: Detected non-determinism while running activation checkpointing

 You are seeing this error because you passed `debug=True` to checkpoint and
 tensors to be saved during the original forward and differ between those saved
 during recomputation. This can happen if different operators were ran in the
 original forward and in the recomputation.

 To identify where the mismatch may be coming from, you can do the following:

 1) Compare the operators ran during original forward and recomputation to
    see where they differ. These operators are printed above in the order they
    were executed.

 2) Review the stack trace for each operator to locate its invocation source.
    Each operator's stack trace is printed in their execution order.

 Note that the logs can be quite long. Here's how they are structured:
 (Tip: you can Ctrl-f for these headers)

 1. Stack traces of the operators that ran in the original forward
 2. Stack traces of the operators that ran during recomputation
 3. Log of operators in the original forward and recomputation
 4. Error message                                             <--- You are here
--------------------------------------------------------------------------------
c                  ó   € ] tR tRtRtR# )r   i�  r    Nr/  r    r$   r"   r   r   �  r0  r$   c               ó   € V ^8„  d   QhRR/# )r   r+   z;Tuple[Callable[[], Any], Callable[[CheckpointError], None]]r    )r!   s   "r"   r#   r#   ‘  s   € ÷ :'ñ :'Ð#^ñ :'r$   c                 óÖ   aaa€ \         P                  ! 4       R9   ;'       d    \         P                  ! 4       R8H  o ! V3R lR4      p V ! 4       oV ! 4       oR VV3R llpVV3R lpW!3# )Úx86_64ÚLinuxc                  ó0   <€ ] tR tRtR R ltV 3R ltRtR# )Ú._get_debug_context_and_cb.<locals>.CaptureLogsi˜  c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú;_get_debug_context_and_cb.<locals>.CaptureLogs.__annotate__™  s   € ÷ 	ñ 	˜dñ 	r$   c                	ó"   € R V n         R V n        R # r?   ©ÚlogsÚtbsr8  s   &r"   rÒ   Ú7_get_debug_context_and_cb.<locals>.CaptureLogs.__init__™  s   € ØˆDŒIØˆDŽHr$   c                	óH   <a € \         P                  VV 3R  l4       pV! 4       # )c            	   3  óú   <"  € \        4       ;_uu_ 4        \        R R R SR7      ;_uu_ 4       p V w  Sn        Sn        V x € RRR4       RRR4       R#   + '       g   i     L; i  + '       g   i     R# ; i5i)T)Ú	python_tbÚ	script_tbÚcpp_tbN)r
   r	   rq  rr  )Úlogs_and_tbrx  rÑ   s    €€r"   Úlogging_modeÚX_get_debug_context_and_cb.<locals>.CaptureLogs.get_context_manager.<locals>.logging_modež  sW   øé € ä&×(Õ(Ü! $°$À$Èv×VÕVÐZeØ*5Ñ'�D”I˜tœxØ%Ò%÷ W÷ )Ñ(ßV×Vú÷ )×(Ð(üs3   ƒA;–A'®A	ÁA'Á

A;ÁA$ÁA'Á'A8	Á2	A;)r¸   Úcontextmanager)rÑ   rz  rx  s   f €r"   Úget_context_managerÚB_get_debug_context_and_cb.<locals>.CaptureLogs.get_context_manager�  s%   ù€ Ü×&Ñ&õ&ó 'ð&ñ
  “>Ð!r$   rp  N)r6   rb   rc   rd   rÒ   r}  rh   )rx  s   €r"   ÚCaptureLogsrl  ˜  s   ø† õ	÷	"ñ 	"r$   r  c               ó    € V ^8„  d   QhRRRR/# )r   r  r   r+   r   r    )r!   s   "r"   r#   Ú/_get_debug_context_and_cb.<locals>.__annotate__©  s   € ÷ ñ ˜?ð ¨xñ r$   c           
     ó4  <€ R  pSP                   f   \        R4      hSP                   f   \        R4      h\        \        P	                  V! RS4      V! RS4      RP                  SP                   4      RP                  SP                   4      R7      4      V h)c           
     ó   € R p\        VP                  4      p\        \        VP                  VP                  RR7      4       F‡  w  pw  rVW% RV^,            RV RV  R2,          pRpV FS  pVR,          R8H  p	V'       g   V	'       g   K!  V	'       d   R	pK-  W(R
,           RVR,           RVR,           R2,          pKU  	  VR,          pK‰  	  V# )rY  Fr…   z   (z of z in z)

ÚnameÚ__torch_dispatch__TÚfilenameÚ:ÚlinerZ  z

)rq   rq  r¡   r‡   rr  )
Úlabelr	   r7   Ú	total_lenr§   ÚlogÚtbÚfound_torch_dispatchrˆ  Úis_torch_dispatchs
   &&        r"   Ú
get_str_tbÚF_get_debug_context_and_cb.<locals>.unpack_error_cb.<locals>.get_str_tbª  sØ   € ØˆCÜ˜L×-Ñ-Ó.ˆIÜ )¬#¨l×.?Ñ.?À×AQÑAQÐZ_Ô*`Ö a‘�‘9�CØ˜˜d 1 q¥5 '¨¨i¨[¸¸U¸GÀ5ÐIÕI�Ø',Ð$Û�Dà(,¨V­Ð8LÑ(LÐ%ß/×8IÙ ß*Ø/3Ð,Ù Ø :Õ.Ð/¨q°°fµ°¸aÀÀVÅ¸~ÈRÐPÕP’Cñ ð �v•’ñ !bð ˆJr$   zcapture_logs_fwd.logs is Nonez#capture_logs_recompute.logs is NoneÚoriginalÚ	recomputerZ  )Úforward_tracesÚrecompute_tracesÚforward_opsÚrecompute_ops)rq  r	  r   Ú_checkpoint_error_templater!   rú   )r  r�  Úcapture_logs_fwdÚcapture_logs_recomputes   & €€r"   rJ  Ú2_get_debug_context_and_cb.<locals>.unpack_error_cb©  s›   ø€ ò	ð" × Ñ Ò(Ü Ð!@ÓAÐAØ!×&Ñ&Ò.Ü Ð!FÓGÐGÜÜ&×-Ñ-Ù)¨*Ð6FÓGÙ!+¨KÐ9OÓ!PØ ŸI™IÐ&6×&;Ñ&;Ó<Ø"Ÿi™iÐ(>×(CÑ(CÓDð	 .ó ó
ð ð	r$   c                 óD   <€ S P                  4       SP                  4       3# r?   )r}  )r˜  r™  s   €€r"   râ   Ú-_get_debug_context_and_cb.<locals>.context_fnÈ  s!   ø€ Ø×3Ñ3Ó5Ð7M×7aÑ7aÓ7cÐcÐcr$   )ri  Úaarch64Úarm64)ÚplatformÚmachineÚsystem)r  rJ  râ   r˜  r™  rx  s      @@@r"   Ú_get_debug_context_and_cbr¢  ‘  se   ú€ ô
 ×ÒÓÐ#AÑA×bÐbÄhÇoÂoÓFWÐ[bÑFb€F÷"ô "ñ #“}ÐÙ(›]Ð÷ñ ö>dð Ð&Ð&r$   c               ó    € V ^8„  d   QhRRRR/# )r   r9   ztorch.Tensorr+   zDict[str, Any]r    )r!   s   "r"   r#   r#   Í  s   € ÷ ñ ˜|ð °ñ r$   c                óN   € R V P                   RV P                  RV P                  /# ©ÚshaperŽ   rL   r¥  ©r9   s   &r"   Ú_default_meta_extractorr¨  Í  s)   € ð 	�—‘Ø�—‘Ø�!—(‘(ðð r$   Únonec                ó   € R # r?   r    )Ú_s   &r"   Ú<lambda>r¬  ×  s   € ‘dr$   z(Dict[str, Callable[[torch.Tensor], Any]]Ú"_allowed_determinism_checks_to_fnsc                  ó   € ] tR tRtRtR# )Ú_StopRecomputationErroriÛ  r    Nr/  r    r$   r"   r¯  r¯  Û  r0  r$   r¯  c                 ó¾   € \         P                  P                  P                  R 4      p V e0   \	        V ^ ,          RR 4      '       d   V ^ ,          P
                  p K3  V # )FÚ_checkpoint_internal)r/   Ú_CÚ	_autogradÚ _top_saved_tensors_default_hooksrM   Ú_user_hooks)Úhookss    r"   Ú!_current_user_saved_tensors_hooksr·  ß  sK   € ô
 �H‰H×Ñ×?Ñ?ÀÓF€EØ
Ò
¤¨¨a­Ð2HÈ%× PÒ PØ�a•×$Ñ$ŠØ€Lr$   c                  ó4   a € ] tR tRtV 3R ltV 3R ltRtV ;t# )Ú_checkpoint_internal_hookiê  c                	óR   <€ \        4       V P                  n        \        SV `  4       # r?   )r·  Ú	pack_hookrµ  ÚsuperÚ	__enter__©rÑ   Ú	__class__s   &€r"   r½  Ú#_checkpoint_internal_hook.__enter__ð  s    ø€ Ü%FÓ%Hˆ�‰Ô"Ü‰wÑ Ó"Ð"r$   c                	ó8   <€ V P                   =\        SV `  ! V!  # r?   )r»  rµ  r¼  Ú__exit__)rÑ   rs   r¿  s   &*€r"   rÂ  Ú"_checkpoint_internal_hook.__exit__ô  s   ø€ Ø�N‰NÐ&Ü‰wÒ Ñ&Ð&r$   r    )r6   rb   rc   rd   r½  rÂ  rh   Ú__classcell__©r¿  s   @r"   r¹  r¹  ê  s   ø† õ#÷'ó 'r$   r¹  c                  ó.   a € ] tR tRtR V 3R lltRtV ;t# )Ú_recomputation_hookiù  c               ó$   € V ^8„  d   QhRRRRRR/# )r   Útarget_frame_refr   r\  zGraphExecGroup | intr+   r<   r    )r!   s   "r"   r#   Ú _recomputation_hook.__annotate__ú  s#   € ÷ 41ñ 41¨ð 41Ð=Qð 41ÐVZñ 41r$   c                	ó†   <aa€ \         P                  P                  VV3R  l4       pR pRVn        \        SV `  W44       R# )c                ó.  <€ V P                   '       d   V P                  4       MT p S! 4       pVf   \        R4      hVP                  S,          pVP                  S;;,          ^,          uu&   V\	        VP
                  4      8¼  dK   VP                  '       d   \        R4      hVP                  '       g
   RVn        V # \        R\         24      hVP
                  V,          ! 4       pVee   \        VP                  P                  SR 4      R J 4       \        4       VP                  S&   WP                  S,          VP                  S,          &   VP                  '       d2   VP                  S,          \	        VP
                  4      8X  d   \         hV # )Nz.Internal error: target_frame reference is Nonez0Unexpected state: target_frame.early_stop is setTzptorch.utils.checkpoint: trying to save more tensors during recomputation than during the original forward pass.
)r3   r2   r	  rG  rq   rB  rå   rL  rM  r   r[  r'  r7  Úgetr.  rE  r¯  )r9   Útarget_frameÚ
recomp_idxr_  r\  rÉ  s   &   €€r"   r»  Ú/_recomputation_hook.__init__.<locals>.pack_hookþ  s_  ø€ àŸoŸo˜o�—‘”
°1ˆAÙ+Ó-ˆLØÒ#Ü$Ð%UÓVÐVØ%×4Ñ4°SÕ9ˆJØ×'Ñ'¨×,°Õ1Ó,àœS ×!:Ñ!:Ó;Ô;Ø×*×*Ð*Ü(Ð)[Ó\Ð\Ø#×5×5Ð5ð :>�LÔ6Ø�HÜ%ðMä%Ð&ð(óð ð "×.Ñ.¨zÖ:Ó<ˆFð Ò!Ü  §¡×!3Ñ!3°C¸Ó!>À$Ð!FÔGÜ&-£i�—‘˜sÑ#ØDE×'Ñ'¨Õ,¨V¯^©^¸CÕ-@ÑAà×&×&Ð&¨<×+FÑ+FÀsÕ+KÌsØ×)Ñ)óPô ,ô .Ð-àˆHr$   c                ó   € V # r?   r    r§  s   &r"   Úunpack_hookÚ1_recomputation_hook.__init__.<locals>.unpack_hook(  s	   € ð ˆHr$   TN)r/   Ú_dynamoÚdisabler±  r¼  rÒ   )rÑ   rÉ  r\  r»  rÒ  r¿  s   &ff  €r"   rÒ   Ú_recomputation_hook.__init__ú  s>   ú€ ô 
�‰×	Ñ	õ'	ó 
ð'	òR	ð
 *.ˆ	Ô&Ü‰Ñ˜Ö0r$   r    ©r6   rb   rc   rd   rÒ   rh   rÄ  rÅ  s   @r"   rÇ  rÇ  ù  s   ø† ÷41ö 41r$   rÇ  c                ó   € V ! V/ VB # r?   r    )Úfnrs   rÖ   s   &*,r"   Ú_run_fn_with_dynamo_disabledrÚ  6  s   € áˆtÐ�vÑÐr$   c                  ó.   a € ] tR tRtR V 3R lltRtV ;t# )Ú_checkpoint_hooki;  c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú_checkpoint_hook.__annotate__<  s   € ÷ @5ñ @5 ñ @5r$   c                	óž   <aa€ V3R  lpV3R loRVn         SP                  e   VV3R lp\        SV `  W#4       R# \        SV `  VS4       R# )c                ób  <€ \        4       pSP                  P                  \        P                  ! V4      4       SP
                  eS   \        P                  ! 4       ;_uu_ 4        SP                  P                  SP                  V 4      4       R R R 4       V# V#   + '       g   i     T# ; ir?   )	r2  rB  r1   rC  ÚrefrI  r/   r¤   rK  )r9   r_  Úframes   & €r"   r»  Ú,_checkpoint_hook.__init__.<locals>.pack_hook=  sx   ø€ ä“YˆFØ×Ñ×%Ñ%¤g§k¢k°&Ó&9Ô:à× Ñ Ò,Ü—]’]—_•_Ø×%Ñ%×,Ñ,¨U×->Ñ->¸qÓ-AÔB÷ %àˆM�6ˆM÷ %–_àˆMús   Á&+BÂB.	c           	     óF  <€ \         P                  4       pVfD   \        P                  P	                  4       pVR8X  d   \        \        P                  ! 4       4      pSP                  V,          '       g©   SP                  4       p \        \        P                  ! S4      V4      ;_uu_ 4        \        P                  P                  4       ;_uu_ 4        \        SP                   .VO5!   R R R 4       R R R 4       RSP                  T&   SP%                  T4       \'        WP(                  9   4       V P(                  V,          f4   Rp\        P                  P+                  4       e   Rp\-        RV R24      h\'        V P(                  V,          SP.                  V,          9   4       SP.                  V,          V P(                  V,          ,          pR V P(                  V&   V#   + '       g   i     EL; i  + '       g   i     EL; i  \"         d     EL!i ; i)NTrY  zÀPerforming two backward calls that overlap (i.e. require the same saved activation in order to compute gradients) is not allowed while under the torch.utils.checkpoint.GraphExecGroup context. z_torch.utils.checkpoint: Unpack is being triggered for a tensor that was already unpacked once. z�If you are calling ctx.saved_tensors in backward, make sure to do so only once. Otherwise please open an issue with details on your use case.r  )r   Ú_get_current_groupr/   r²  Ú_current_graph_task_idrF  ÚuuidÚuuid4rH  rU  rÇ  rC  rá  r±   rº   rÚ  r@  r¯  rd  r'  r7  Ú_get_graph_exec_groupr   rE  )r_  r\  rs   Úextrar  râ  s   &    €r"   rÒ  Ú._checkpoint_hook.__init__.<locals>.unpack_hookG  s·  ø€ ä/=×/PÑ/PÓ/RˆCØŠ{ä—h‘h×5Ñ5Ó7�Ø˜"”9äœdŸjšj›lÓ+�Cà×&Ñ& s×+Ô+Ø×'Ñ'Ó)�ðÜ,ÜŸš EÓ*¨C÷õ ä—~‘~×1Ñ1×3Õ3ä4°U×5GÑ5GÐOÈ$ÔO÷ 4÷ð ,0�×#Ñ# CÑ(Ø×4Ñ4°SÔ9ä˜S§N¡NÑ2Ô3à�~‰~˜cÕ"Ò*Ø�Ü—8‘8×1Ñ1Ó3Ò?ðTð ô
 &ð&Ø&+ Wð -hðhóð ô
 ˜VŸ^™^¨CÕ0°E×4DÑ4DÀSÕ4IÑIÔJØ×"Ñ" 3Õ'¨¯©°sÕ(;Õ<ˆCØ"&ˆF�N‰N˜3ÑØˆJ÷5 4×3Ð3ú÷÷ ð ûô
 /ô ÚðúsH   Â(H Â/'G=ÃG)	Ã.G=Ã6H Ç)G:Ç4	G=Ç=H	ÈH ÈH ÈH ÈH TNc                ój   <€  S! V 4      #   \          d   pSP                  T4        R p?R # R p?ii ; ir?   )r   rJ  )r_  r  râ  rÒ  s   & €€r"   Úunpack_hook_with_error_cbÚ<_checkpoint_hook.__init__.<locals>.unpack_hook_with_error_cbu  s4   ø€ ð-Ù& vÓ.Ð.øÜ&ô -Ø×)Ñ)¨!×,Ò,ûð-ús   ƒ ‹2–-­2)r±  rJ  r¼  rÒ   )rÑ   râ  r»  rí  rÒ  r¿  s   &f  @€r"   rÒ   Ú_checkpoint_hook.__init__<  sG   ú€ õ	õ*	ðX *.ˆ	Ô&Ø× Ñ Ò,ö-ô
 ‰GÑ˜YÖBä‰GÑ˜Y¨Ö4r$   r    r×  rÅ  s   @r"   rÜ  rÜ  ;  s   ø† ÷@5ö @5r$   rÜ  c                óÔ   € \         P                  P                  4       '       d   R # \         P                  P	                  \         P                  P
                  P                  4      RJ# r?  )r/   ÚcompilerÚ_is_non_strict_tracingr²  Ú_get_dispatch_modeÚ_TorchDispatchModeKeyÚPROXY)Úfuncrs   rÖ   s   &&&r"   Ú_is_compilingr÷    sE   € ô ‡~�~×,Ñ,×.Ò.ÙÜ�8‰8×&Ñ&¤u§x¡x×'EÑ'E×'KÑ'KÓLÐTXÐXÐXr$   c                  ó,   € ] tR tRtRR R lltR tRtR# )Ú_VersionWrapperi‡  Nc               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú_VersionWrapper.__annotate__‰  s   € ÷ 'ñ '°ñ 'r$   c                	ó„   € Wn         \        V\        P                  4      '       d   VP                  MR V n        W n        R # r?   )Úvalr-   r/   r0   Ú_versionÚversionrÒ  )rÑ   rý  rÒ  s   &&&r"   rÒ   Ú_VersionWrapper.__init__‰  s-   € Ø'*ŒÜ3=¸cÄ5Ç<Á<×3PÒ3P 3§<¢<ÐVZˆŒð 'Ör$   c                	óø   € V P                   e9   V'       g1   V P                  P                  V P                   8w  d   \        R4      hV P                  f   V P                  # V P	                  V P                  4      # )NzETensor cached during selective activation checkpoint has been mutated)rÿ  rý  rþ  r4   rÒ  )rÑ   Úallow_cache_entry_mutations   &&r"   Úget_valÚ_VersionWrapper.get_val�  s`   € Ø�<‰<Ò#×,FØ�x‰x× Ñ  D§L¡LÔ0ä"Ø[óð ð  ×+Ñ+Ò3ˆt�x‰xÐS¸×9IÑ9IÈ$Ï(É(Ó9SÐSr$   )rÒ  rý  rÿ  r?   )r6   rb   rc   rd   rÒ   r  rh   r    r$   r"   rù  rù  ‡  s   † ÷'öTr$   rù  c                ó8  € \        V \        P                  4      '       df   \        P                  P	                  \        P                  P
                  P                  R 4      ;_uu_ 4        V P                  4       p RRR4       V # V #   + '       g   i     T # ; ir?  )r-   r/   r0   r²  Ú_SetExcludeDispatchKeyGuardÚDispatchKeyÚADInplaceOrViewr2   r§  s   &r"   Ú_detach_helperr	  š  sl   € ô
 �!”U—\‘\×"Ò"Ü�X‰X×1Ñ1´%·(±(×2FÑ2F×2VÑ2VÐX]×^Õ^ð —‘“
ˆA÷ _ð €Hˆ1€H÷ _Ö^ð €Hús   Á+BÂB	c                  ó.   € ] tR tRtRtRR/R R lltRtR# )r   iª  aÙ  
Context passed to policy function during selective checkpointing.

This class is used to pass relevant metadata to the policy function during
selective checkpointing.

The policy function is only called during the forward pass. During
recomputation, cached values are retrieved by index, so ``is_recompute``
is deprecated and always ``False``.

Example:
    >>> # xdoctest: +SKIP(stub)
    >>>
    >>> def policy_fn(ctx, op, *args, **kwargs):
    >>>    print(ctx.op_output)
    >>>
    >>> context_fn = functools.partial(create_selective_checkpoint_contexts, policy_fn)
    >>>
    >>> out = torch.utils.checkpoint.checkpoint(
    >>>     fn, x, y,
    >>>     use_reentrant=False,
    >>>     context_fn=context_fn,
    >>> )
Ú	op_outputNc               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú'SelectiveCheckpointContext.__annotate__Ã  s   € ÷ #ñ #¸4ñ #r$   c               	ó   € Wn         W n        R # r?   ©Úis_recomputer  )rÑ   r  r  s   &$$r"   rÒ   Ú#SelectiveCheckpointContext.__init__Ã  s   € Ø(ÔØ"Žr$   r  )r6   rb   rc   rd   re   rÒ   rh   r    r$   r"   r   r   ª  s   † ñð0#°$÷ #ó #r$   c                  ó2   € ] tR tRtRt^ t^t^t^t^t	^t
RtR# )r   iÈ  a  
Enum for specifying the policy for checkpointing during backpropagation.

The following policies are supported:

- ``{MUST,PREFER}_SAVE``: The operation's output will be saved during the forward
  pass and will not be recomputed during the backward pass
- ``{MUST,PREFER}_RECOMPUTE``: The operation's output will not be saved during the
  forward pass and will be recomputed during the backward pass
- ``{MUST,PREFER}_CPU_OFFLOAD``: The operation's output will be saved during the
  forward pass, offloaded to CPU, and reloaded to GPU during the backward pass

Use ``MUST_*`` over ``PREFER_*`` to indicate that the policy should not be overridden
by other subsystems like `torch.compile`.

.. note::
    A policy function that always returns ``PREFER_RECOMPUTE`` is
    equivalent to vanilla checkpointing.

    A policy function that returns ``PREFER_SAVE`` every op is
    NOT equivalent to not using checkpointing. Using such a policy would
    save additional tensors not limited to ones that are actually needed for
    gradient computation.
r    N)r6   rb   rc   rd   re   Ú	MUST_SAVEÚPREFER_SAVEÚMUST_RECOMPUTEÚPREFER_RECOMPUTEÚMUST_CPU_OFFLOADÚPREFER_CPU_OFFLOADrh   r    r$   r"   r   r   È  s*   † ñð0 €IØ€KØ€NØÐØÐØÔr$   c                óR   € V '       d   \         P                  # \         P                  # r?   ©r   r  r  )Úbs   &r"   Ú_policy_from_boolr  é  s   € ç)*Ô×%Ñ%ÐQÔ0@×0QÑ0QÐQr$   c                ód   € ^ RI HpHp WJ d#   V'       d   W! V^ ,          4      P                  3# V # )a?  Compute the SAC storage key for a given op.

For inductor_compiled_code, each compiled region gets its own FIFO queue
keyed by the callable's unique idx.  Without this, all compiled regions
share one queue and a cache-hit that skips a region during recompute
causes the queue to return the wrong entry (see gh-175258).
)Ú_resolve_inductor_callableÚinductor_compiled_code)Útorch._higher_order_ops.wrapr  r  r¾   )rö  rs   r  Ú_inductor_compiled_codes   &&  r"   Ú_sac_storage_keyr"  ø  s1   € ÷ð Ó&¯4ØÐ0°°aµÓ9×=Ñ=Ð>Ð>Ø€Kr$   c                  ó@   € ] tR tRt]R 4       tRR R lltR	R ltRtR# )
Ú_CachingTorchDispatchModei	  c                	ó   € R # ©Tr    ©Úclss   &r"   Úignore_compile_internalsÚ2_CachingTorchDispatchMode.ignore_compile_internals
  ó   € ár$   Nc               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú&_CachingTorchDispatchMode.__annotate__  s   € ÷ 
=ñ 
=Àñ 
=r$   c                	ó`   € Wn         W n        W0n        R V n        \	        \
        4      V n        R # r?   )Ú	policy_fnÚstorageÚac_graph_idræ   r   rF  Úfunc_counter)rÑ   r/  r0  r1  s   &&&&r"   rÒ   Ú"_CachingTorchDispatchMode.__init__  s)   € Ø"ŒØŒØ&Ôð 9=ˆÔ(Ü,7¼Ó,<ˆÖr$   c                	óô  a€ Vf   / MTp\        WV4      pV'       d?   V P                  \        P                  R&   \        P
                  \        P                  R&   V\        9   d	   V! V/ VB # R p^ pV'       d;   ^ RIHp V! 4       pVe*   \        VP                  P                  P                  4      pV! V/ VB p	\        W4      p
V P                  V
,          pV P                  V
;;,          ^,          uu&   V P                  ! \!        RV	R7      V.VO5/ VB p\#        V\$        4      '       d   \'        V4      pV'       dv   Ver   VP                  P                  p\        VP                  4      V,
          p\(        P*                  ! \-        VP                  4      V4       F  pWÏP.                  R&   K  	  V\        P0                  \        P2                  39   g	   V'       dx   V'       d   R M	\5        4       oSe8   V P6                  pVf   \8        P:                  ! R\<        ^R7       V'       g   R oV3R lp\?        VV	4      V P@                  V
,          V&   V	# \B        V P@                  V
,          V&   V	# )	Nr1  r’  )Úget_proxy_modeFr  a„  A saved_tensors_hooks context (e.g. save_on_cpu) is active around a selective activation checkpoint region. Tensors that SAC saves currently bypass these hooks, but a future release will route them through the hooks like any other saved tensor. Silence this warning and choose the behavior explicitly by passing respect_saved_tensors_hooks=True|False to torch.utils.checkpoint.checkpoint.rD   c                óº   <€ \        V 4      p SeB   \        V \        P                  4      '       d"   \	        S^ ,          ! V 4      S^,          R7      # \	        V 4      # )N)rÒ  )r	  r-   r/   r0   rù  )r9   Ú
user_hookss   &€r"   ÚwrapÚ:_CachingTorchDispatchMode.__torch_dispatch__.<locals>.wrap_  sI   ø€ Ü" 1Ó%�ØÒ)¬j¸¼E¿L¹L×.IÒ.IÜ*¨:°a®=¸Ó+;ÈÐTUÍÔWÐWÜ& qÓ)Ð)r$   )"r÷  r1  Úfx_tracebackÚcurrent_metar   r  ÚSAC_IGNORED_OPSÚ"torch.fx.experimental.proxy_tensorr5  rq   ÚtracerÚgraphÚnodesr"  r2  r/  r   r-   ré   r  Ú	itertoolsÚisliceÚreversedrK   r  r  r·  ræ   rG   rH   ÚFutureWarningr   r0  Ú
_RECOMPUTE)rÑ   rö  Útypesrs   rÖ   Úis_compilingÚ
proxy_modeÚgraph_len_beforer5  r7   Úkeyr¾   Úpolicyr?  Únum_newÚnodeÚrespectsr8  r7  s   &&&&&             @r"   r…  Ú,_CachingTorchDispatchMode.__torch_dispatch__  s%  ø€ Ø’~‘¨6ˆÜ$ T°Ó8ˆçØ7;×7GÑ7GŒL×%Ñ% mÑ4Ü5E×5VÑ5VŒL×%Ñ% kÑ2à”?Ô"Ù˜Ð( Ñ(Ð(àˆ
ØÐßÝIÙ'Ó)ˆJØÒ%Ü#& z×'8Ñ'8×'>Ñ'>×'DÑ'DÓ#EÐ á�DÐ#˜FÑ#ˆä˜tÓ*ˆØ×Ñ Õ$ˆØ×Ñ˜#× !Õ#Óà—’Ô :ÈÐY\Ô ]Ø $ð7Ø'+ò7Ø/5ñ7ˆä�fœd×#Ò#Ü& vÓ.ˆFçØÒ%Ø"×)Ñ)×/Ñ/�Ü˜eŸk™kÓ*Ð-=Õ=�Ü%×,Ò,¬X°e·k±kÓ-BÀGÖL�DØ-3—I‘I˜kÓ*ñ Mð Ô&×0Ñ0Ô2B×2NÑ2NÐOÔO×S_÷ ".™Ô3TÓ3VˆJØÒ%Ø×;Ñ;�ØÒ#Ü—M’Mð=ô &Ø#$õ÷  Ø!%�Jõ*ô &.¨d°CÓ%8ˆD�L‰L˜Õ˜cÑ"ð ˆ
ô &0ˆD�L‰L˜Õ˜cÑ"Øˆ
r$   )r1  r2  r/  ræ   r0  r?   ©r    N)	r6   rb   rc   rd   Úclassmethodr)  rÒ   r…  rh   r    r$   r"   r$  r$  	  s%   † Øñó ð÷
=÷Mð Mr$   r$  z–This can happen if the operations in the checkpointed region are nondeterministic or depend on global state that changed between forward and backward.c                  óR   a € ] tR tRt]R 4       tRR R lltV 3R ltR	R ltRt	V ;t
# )
Ú_CachedTorchDispatchModeit  c                	ó   € R # r&  r    r'  s   &r"   r)  Ú1_CachedTorchDispatchMode.ignore_compile_internalsu  r+  r$   c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   Ú%_CachedTorchDispatchMode.__annotate__{  s   € ÷ =ñ =ÐPTñ =r$   c                	óF   € W n         W0n        \        \        4      V n        R # r?   )r0  r  r   rF  r2  )rÑ   r/  r0  r  s   &&&&r"   rÒ   Ú!_CachedTorchDispatchMode.__init__{  s   € ØŒØ*DÔ'Ü,7¼Ó,<ˆÖr$   c                	óT   <€ V P                   P                  4        \        SV `  4       # r?   )r2  Úclearr¼  r½  r¾  s   &€r"   r½  Ú"_CachedTorchDispatchMode.__enter__€  s#   ø€ à×Ñ×ÑÔ!Ü‰wÑ Ó"Ð"r$   c                	óð  a € V\         9   d	   V! V/ VB # \        W4      pS P                  V,          pS P                  V;;,          ^,          uu&   S P                  P	                  V4      pVf   \        V R\         24      hVP	                  V4      pVf   \        V RV R\         24      hV\        J d   \        R4      hV\        J d   Vf   / MTpV! V/ VB # \        Wv&   \        V 3R lV4      # )r  z7 encountered during backward but not found in storage. z invocation index z…Trying to backward an extra time. You are only allowed to backward once on any region computed under selective activation checkpoint.c                ó:   <€ V P                  SP                  4      # r?   )r  r  )r9   rÑ   s   &€r"   r¬  Ú=_CachedTorchDispatchMode.__torch_dispatch__.<locals>.<lambda>£  s   ø€  a§i¡i°×0OÑ0OÔ&Pr$   )
r<  r"  r2  r0  rÍ  r4   Ú_SAC_MISMATCH_MSGÚ	_CONSUMEDrE  r   )	rÑ   rö  rF  rs   rÖ   rJ  r¾   Úfunc_storageÚentrys	   f&&&&    r"   r…  Ú+_CachedTorchDispatchMode.__torch_dispatch__…  s!  ø€ Ø”?Ô"Ù˜Ð( Ñ(Ð(ä˜tÓ*ˆØ×Ñ Õ$ˆØ×Ñ˜#× !Õ#Óà—|‘|×'Ñ'¨Ó,ˆØÒÜØ�&ð Ü-Ð.ð0óð ð × Ñ  Ó%ˆØŠ=ÜØ�&Ð*¨3¨%ð 0-Ü->Ð,?ðAóð ð ”iÓÜðPóð ð ”jÓ Ø!š>‘R¨vˆFÙ˜Ð( Ñ(Ð(ä )ˆLÑÜÔPÐRWÓXÐXr$   )r  r2  r0  ©FrP  )r6   rb   rc   rd   rQ  r)  rÒ   r½  r…  rh   rÄ  rÅ  s   @r"   rS  rS  t  s+   ø† Øñó ð÷
=õ
#÷
Yò Yr$   rS  c           	     óø  a € \        S \        4      '       d    S  F’  p\        V\        P                  P                  \        P                  P
                  34      '       d   KI  \        V\        P                  P                  4      '       d   RMRp\        RV R\        V4       RV 24      h	  V 3R lpM\        S 4      '       d   S pM\        R4      h\        \        4      p\        WE4      \        RWQ4      3# )	aã  
Helper to avoid recomputing certain ops during activation checkpointing.

Use this with `torch.utils.checkpoint.checkpoint` to control which
operations are recomputed during the backward pass.

Args:
    policy_fn_or_list (Callable or List):
      - If a policy function is provided, it should accept a
        :class:`SelectiveCheckpointContext`, the :class:`OpOverload`, args and
        kwargs to the op, and return a :class:`CheckpointPolicy` enum value
        indicating whether the execution of the op should be recomputed or not.
      - If a list of operations is provided, it is equivalent to a policy
        returning `CheckpointPolicy.MUST_SAVE` for the specified
        operations and `CheckpointPolicy.PREFER_RECOMPUTE` for all other
        operations.
    allow_cache_entry_mutation (bool, optional): By default, an error is
        raised if any tensors cached by selective activation checkpoint are
        mutated in order to ensure correctness. If set to `True`, this check
        is disabled.
Returns:
    A tuple of two context managers.

Example:
    >>> # xdoctest: +REQUIRES(LINUX)
    >>> import functools
    >>>
    >>> x = torch.rand(10, 10, requires_grad=True)
    >>> y = torch.rand(10, 10, requires_grad=True)
    >>>
    >>> ops_to_save = [
    >>>    torch.ops.aten.mm.default,
    >>> ]
    >>>
    >>> def policy_fn(ctx, op, *args, **kwargs):
    >>>    if op in ops_to_save:
    >>>        return CheckpointPolicy.MUST_SAVE
    >>>    else:
    >>>        return CheckpointPolicy.PREFER_RECOMPUTE
    >>>
    >>> context_fn = functools.partial(create_selective_checkpoint_contexts, policy_fn)
    >>>
    >>> # or equivalently
    >>> context_fn = functools.partial(create_selective_checkpoint_contexts, ops_to_save)
    >>>
    >>> def fn(x, y):
    >>>     return torch.sigmoid(torch.matmul(torch.matmul(x, y), y)) * y
    >>>
    >>> out = torch.utils.checkpoint.checkpoint(
    >>>     fn, x, y,
    >>>     use_reentrant=False,
    >>>     context_fn=context_fn,
    >>> )
z“Please update the OpOverloadPacket to a specific OpOverload.For example, if you have `torch.ops.aten.mm`, change it to `torch.ops.aten.mm.default`.rY  z6Expected op in `op_list` to be an OpOverload but got: z	 of type z. c                óR   <€ VS9   d   \         P                  # \         P                  # r?   r  )r¥   Úoprs   rÖ   Úpolicy_fn_or_lists   &&*,€r"   r/  Ú7create_selective_checkpoint_contexts.<locals>.policy_fnë  s$   ø€ ØÐ&Ô&Ü'×1Ñ1Ð1ä'×8Ñ8Ð8r$   z=policy_fn_or_list must be either a function or a list of ops.N)r-   r³   r/   Ú_opsÚ
OpOverloadÚHigherOrderOperatorÚOpOverloadPacketrù   r5   ÚcallableÚ	TypeErrorr   rÍ   r$  rS  )ri  r  rh  Ú
_extra_msgr/  r0  s   f&    r"   Ú$create_selective_checkpoint_contextsrr  ¦  så   ø€ ôr Ð#¤T×*Ò*Û#ˆBÜ˜b¤5§:¡:×#8Ñ#8¼%¿*¹*×:XÑ:XÐ"Y×ZÔZô   ¤E§J¡J×$?Ñ$?×@Ò@ñnàFHð ô !ØLÈRÈDð QÜ# B›x˜j¨¨:¨,ð8óð ñ $ö	9ô
 
Ð#×	$Ò	$Ø%‰	äÐWÓXÐXä)4´TÓ):€Gä! )Ó5Ü   wÓKðð r$   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# ©
r   râ   rê   rã   rS   rä   ré   rå   ræ   r   r    )r!   s   "r"   r#   r#   þ  s?   € ÷ ñ ð Dðð ð	ð
 ðð ðð "-ñr$   c               ó*   € \        V VVVVVVVVR 7	      # )r  )r  )	rÙ  rœ   râ   rã   rä   rå   ræ   rs   rÖ   s	   &&&&&&$*,r"   Ú'_checkpoint_without_reentrant_generatorrv  þ  s,   € ô 8Ø
ØØØ-ØØ+ØØØ$?ô
ð 
r$   c          
     ó,   € V ^8„  d   QhRRRRRRRRRR	/# rt  r    )r!   s   "r"   r#   r#     sF   € ÷ Añ Að DðAð ðAð ðAð ðAð "-ñAr$   c             #  óB  a aaaaaaaaaaaaaaa"  € Rp	\         e   \         '       d+   MV'       d"   V\        Jd   \        R4      h\        4       w  rIV\        9   d   \        V,          p
M,\        R\        \        P                  4       4       RV 24      h\        V!  o\        S4      pV! 4       w  po\        V\        4      '       d   WŒn        \        S VS4      '       dB   V\        Jd8   \        V\        4      '       d   \        S\        4      '       g   \        R4      h\        SR7      w  ooS'       d9   \         P"                  ! 4       oRo\%        VRR4      '       d   R	o\'        V!  w  oo^ R
IHp ^ RIHo \1        V3R l\3        V! 4       4       4       \4        P6                  ! 4       4      o\         P8                  P:                  P<                  o\         P>                  PA                  4       o\         PB                  PD                  PG                  4       oR VVVVVV VVVVVVVVV3R llp\I        T\J        e   \J        MTV	V
4      p\         PL                  ! 4       '       g   Rx € R# \        V\        4      '       dK   \         PN                  PP                  PS                  R4      e    \         PN                  PU                  R4       VPV                  ! V!   Rp\Y        V4      ;_uu_ 4        T;_uu_ 4         Rx €  RRR4       RRR4       T'       d   \]        R4      hR	Tn/        \%        TRR4      '       d   S'       d   S'       g   \]        R4      hR#   \Z         d    R	ph i ; i  + '       g   i     Lt; i  + '       g   i     L; i5i)a  Checkpointing without reentrant autograd.

Args:
    fn: describes what to run in the forward pass of the model or
        part of the model. It should also know how to handle the inputs
        passed as the tuple. For example, in LSTM, if user passes
        ``(activation, hidden)``, :attr:`function` should correctly use the
        first input as ``activation`` and the second input as ``hidden``
    args: Tuple of arguments to pass in to the given ``function``.
    kwargs: Dict of keyword arguments to pass into the given ``function``.
    preserve_rng_state(bool, optional):  Omit stashing and restoring
        the RNG state during each checkpoint.
        Default: ``True``
    context_fn(Callable, optional): A callable returning a tuple of two
        context managers. The function and its recomputation will be run
        under the first and second context managers respectively.
    determinism_check(str, optional): A string specifying the determinism
        check to perform. By default it is set to ``"default"`` which
        compares the shapes, dtypes, and devices of the recomputed tensors
        against those the saved tensors. To turn off this check, specify
        ``"none"``. Currently these are the only two supported values.
        Please open an issue if you would like to see more determinism
        checks.
    debug(bool, optional): If ``True``, error messages will also include
        a trace of the operators ran during the original forward computation
        as well as the recomputation.
    early_stop(bool, optional): If ``True``, non-reentrant checkpoint stops
        recomputation as soon as it has computed all needed Tensors. Can be
        overridden globally using :func:`set_checkpoint_early_stop` context
        manager. Default: ``True``.
Nz6debug=True is incompatible with non-default context_fnz#determinism_check should be one of z
, but got z}In torch.compile mode, `context_fn` arg passed to `torch.utils.checkpoint` must generate a tuple of two `TorchDispatchMode`s.r­   Frš   T)Ú _get_current_function_mode_stack)ÚDeviceContextc              3  óp   <"  € T F+  p\        VS4      '       g   K  S! VP                  4      x € K-  	  R # 5ir?   )r-   rL   )rA   Úmoderz  s   & €r"   rB   Ú?_checkpoint_without_reentrant_generator_impl.<locals>.<genexpr>  s0   øé € ð 	
áD�Ü˜$ ×.ô '‰M˜$Ÿ+™+×&Ð&ÛDùs   ƒ6œ6c               ó   € V ^8„  d   QhRR/# rƒ   r    )r!   s   "r"   r#   ÚB_checkpoint_without_reentrant_generator_impl.<locals>.__annotate__Š  s   € ÷  $ñ  $˜tñ  $r$   c                 óÎ  <€ . pS'       d   S'       d   Sp\         P                  P                  VSSR 7      ;_uu_ 4        S'       d-   \         P                  ! S
4       S'       d   \	        SSSR7       \         P
                  P                  S4      '       d#   \         P
                  P                  ! RRS/SB M\        P                  ! 4       pS'       d+   \         P                  P                  P                  SR7      M\        P                  ! 4       pT;_uu_ 4        \         P
                  P                  ! R/ SB ;_uu_ 4        S;_uu_ 4        S;_uu_ 4        T;_uu_ 4        \         P                  P                  P                  S4      ;_uu_ 4        S	! V / SB  RRR4       RRR4       RRR4       RRR4       RRR4       RRR4       RRR4       R#   + '       g   i     LB; i  + '       g   i     LM; i  + '       g   i     LX; i  + '       g   i     Lc; i  + '       g   i     Ln; i  + '       g   i     Ly; i  + '       g   i     R# ; i)r¬   r­   r�   )Úerror_on_nested_fx_traceNr    rk   )r/   rµ   r¶   rˆ   rŒ   r�   r‘   r·   r¸   r¹   rÔ  ÚconfigÚpatchÚfxÚ_symbolic_traceÚ_is_fx_tracing_context)rs   r¿   rÁ   Únested_fx_trace_ctxr–   r•   Ú
device_ctxr�   r�  rÙ  r�   r~   rŸ   rž   Úis_fx_tracingÚis_non_strict_tracingrÖ   rœ   Úrecompute_contexts   *   €€€€€€€€€€€€€€€r"   r@  ÚB_checkpoint_without_reentrant_generator_impl.<locals>.recompute_fnŠ  s®  ø€ ð ˆß×"3Ø%ˆKÜ�\‰\×"Ñ"ØÐ);Èð #÷ 
õ 
÷ "Ü×#Ò# MÔ2ß$Ü% kÐ3DÐR]Õ^ô —‘×0Ñ0°×=Ò=ô #(§)¡)×"4Ò"4ñ #Ø'ð#Ø+Aò#äCM×CYÒCYÓC[ð  ÷ )ô —‘×$Ñ$×*Ñ*Ø-Eð +ô ô  ×+Ò+Ó-ð  ÷ $Ò#Ü—	‘	×"Ò"Ñ@Ð,?×@Ó@ß!Ò!ß’
ß#Ò#Ü—‘×(Ñ(×?Ñ?À×NÕNá�DÐ#˜FÒ#÷ O÷ $÷ ÷ "÷ A÷ $÷'
ñ 
÷0 O×Nú÷ $×#ú÷ —
ú÷ "×!ú÷ A×@ú÷ $×#ú÷'
÷ 
ð 
ús¯   Á &IÁ'2IÂ>IÃA	IÄ")I 	ÅH-ÅHÅ!HÅ,2G4Æ	G!Æ'G4Æ/HÆ7HÆ?H-ÇI 	ÇIÇ!G1!Ç,G4Ç4HÇ?HÈHÈHÈH*È%H-È-H=È8I 	É IÉIÉI$	z3torch.utils.checkpoint.sac_with_saved_tensors_hooksr  z�PyTorch's device state was initialized in the forward pass of a Checkpoint, which is not allowed. Please open an issue if you need this feature.)0r   rÇ   rù   r¢  r­  r³   Úkeysru   rO   r-   r$  ræ   r÷  r   r	  r—   r/   r}   rM   r€   Útorch.overridesry  Útorch.utils._devicerz  r  rC  r¸   r¹   rÔ  r‚  r�  rñ  rò  r„  r…  Ú_get_is_fx_tracingr;  r(  Úis_grad_enabledr²  r³  r´  Ú_log_api_usage_oncerQ  rÜ  r  r4   rL  )rÙ  rs   rÖ   rœ   râ   rã   rä   rå   ræ   rJ  rI  rN   Úforward_contextry  r@  Ú	new_frameÚforward_context_suppressed_excrz  r–   r•   rˆ  r�   r�  r�   r~   rŸ   rž   r‰  rŠ  r‹  s   f&fd$$$$$        @@@@@@@@@@@@@r"   r  r    s  ÿÿé € ðV €Oä$=Ò$I× Ô ÏuØœ_Ó,ÜØHóð ô '@Ó&AÑ#ˆ
àÔ>Ô>Ü8Ð9JÕK‰äØ1´$Ô7Y×7^Ñ7^Ó7`Ó2aÐ1bð cØ(Ð)ð+ó
ð 	
ô
 % dÑ+€KÜ& {Ó3€MÙ)3«Ñ&€OÐ&ô
 �/Ô#<×=Ò=Ø6QÔ3Ü�R˜˜v×&Ò&¨:¼_Ó+Lä˜?Ô,=×>Ò>ÜÐ/Ô1B×CÒCä ðEóð ô
 3GÐS^Ô2_Ñ/ÐÐ/çÜ×+Ò+Ó-ˆð "ÐÜ�= .°%×8Ò8Ø $ÐÜ->ÀÑ-EÑ*ˆKÐ*å@Ý1ô ô	
ä Ñ!AÓ!CÔDó	
ô
 	×ÒÓ ó€Jô  %Ÿ}™}×3Ñ3×LÑLÐÜ!ŸN™N×AÑAÓCÐÜ—H‘H×,Ñ,×?Ñ?ÓA€M÷ $÷  $ö  $ôD !ØÜ)FÒ)RÕ%ÐXbØØó	€Iô × Ò ×"Ò"ÛÙô 	�?Ô$=×>Ò>Ü�H‰H×Ñ×?Ñ?ÀÓFÒRä�‰×$Ñ$ØAô	
ð ×Ò˜4Ò à%*Ð"Ü	˜)×	$Õ	$§o¢oð	Ü÷ '6×	$÷ &Üð:ó
ð 	
ð #'€IÔäˆ}˜n¨e×4Ò4ß×"3ô ð(ó
ð 	
ñ øô- ô 	Ø-1Ð*Øð	ú÷ '6§oú×	$×	$üsk   ’N©N²H=NÉ0BNË;NÌM9	ÌM'ÌNÌNÌ%,NÍNÍNÍ'M6Í6M9	Í9N	ÎNÎN	ÎNc                  óH   € ] tR tRtRtR R ltR R lt]R R l4       tR	t	R
# )r   iÞ  a'  Any checkpointed regions encountered by backward under the same instance
of this context manager will trigger recompute at most once, even if
there are multiple calls to backward.

Backward calls under the same instance of this context manager must execute
over non-overlapping regions of the backward graph even if retain_graph=True.
In particular, any two backward call cannot use the same saved activation for
gradient computation.

.. note::
    This context manager only affects checkpoint with use_reentrant=False, and
    is a no-op otherwise.
c               ó   € V ^8„  d   QhRR/# )r   r+   r   r    )r!   s   "r"   r#   ÚGraphExecGroup.__annotate__í  s   € ÷ ñ ˜4ñ r$   c                	óØ   € \         P                  P                  4       e+   \        R\         P                  P                  4        24      h\         P                  P	                  V 4       V # )Nz?GraphExecGroup contexts cannot be nested. Already inside group )r/   r²  ré  r4   Ú_set_graph_exec_groupr8  s   &r"   r½  ÚGraphExecGroup.__enter__í  sY   € Ü�8‰8×)Ñ)Ó+Ò7Üð(Ü(-¯©×(FÑ(FÓ(HÐ'IðKóð ô 	�‰×&Ñ& tÔ,Øˆr$   c               ó    € V ^8„  d   QhRRRR/# )r   rs   Úobjectr+   r<   r    )r!   s   "r"   r#   r˜  ö  s   € ÷ -ñ -˜fð -¨ñ -r$   c                	óD   € \         P                  P                  R 4       R # r?   )r/   r²  rš  )rÑ   rs   s   &*r"   rÂ  ÚGraphExecGroup.__exit__ö  s   € Ü�‰×&Ñ& tÖ,r$   c               ó   € V ^8„  d   QhRR/# )r   r+   zGraphExecGroup | Noner    )r!   s   "r"   r#   r˜  ú  s   € ÷ 0ñ 0Ð#8ñ 0r$   c                	ó>   € \         P                  P                  4       # r?   )r/   r²  ré  r'  s   &r"   rå  Ú!GraphExecGroup._get_current_groupù  s   € ô �x‰x×-Ñ-Ó/Ð/r$   r    N)
r6   rb   rc   rd   re   r½  rÂ  rQ  rå  rh   r    r$   r"   r   r   Þ  s%   † ñõõ-ð ô0ó ô0r$   )rí   r#  r   r   rI   r:   r€   rŒ   rÇ   r,  r   r'   r   r   rr  r<  r   r`   r?   re  )rÚ__conditional_annotations__Ú
__future__r   r¸   rÏ   rA  rŸ  rç  rG   rC  Úcollectionsr   ÚtypingÚtyping_extensionsr   Úenumr   r/   Útorch.fx.tracebackr„  Ú	tracebackr:  Útorch.utils._pytreer   Ú&torch.testing._internal.logging_tensorr	   r
   Útorch.utils._python_dispatchr   Útorch._C._autogradr   r   r   r   r   r   Ú__all__Ú_DEFAULT_DETERMINISM_MODEr   r   r   rf   r|  r'   r:   rI   rO   r   ru   r€   rŒ   r—   r±   ÚFunctionr   rÇ   rÉ   rà   rí   Ú_disable_dynamorÕ   r#  r'  r(  r,  r.  r2  r;  r[  r—  r4   r   r¢  r¨  r­  Ú	Exceptionr¯  r·  r?  Úsaved_tensors_hooksr¹  rÇ  rÚ  rÜ  r÷  rù  r	  r   ÚEnumr   r  ÚopsÚatenr2   r   ÚprimrL   rp   Ú_subclassesÚfunctional_tensorÚFunctionalTensorÚmetadata_fnsr<  r"  r$  r�  rE  ra  r`  rS  rr  rv  r  r   )r£  s   @r"   Ú<module>r½     sÈ  øðç "Ð "ã Û Û Û Û Û Û Ý #Ü Ý "Û Ý !ã ß )Ð )Ý (ß RÝ :ß >ß 9Ó 9ò€ð( &Ð áˆTƒ]€Ùˆtƒ_€à)-Ð ˜;Ó -ð ×Ñô)ó ð)õ*
õ$
ô÷!6ñ !6òHõF-ð*/°d÷ /ô(7ô&g$˜Ÿ™×0Ñ0ô g$òT>÷
ñ 
ò<@ð 
ðð "&ðð  $ð	ð
 GVðð 7ðð ðð ðð 04öó 
ðð 
ñ
9ð "&ð
9ð  $ð	
9ð
 GVð
9ð 7ð
9ð ð
9ð ð
9ð 04÷
9ó 
ð
9ð0 ×ÑñBð "&ðBð  $ð	Bð
 GVðBð 7ðBð ðBð ðBð 04÷Bó ðBðJN
ð
 "&ðN
ð  $ðN
ð GVðN
ð 7ðN
ð ðN
ð ðN
ð 04÷N
ôbYGõx
ðV .2Ð ˜{Ó 1ð ×Ñô-ó ð-÷<	ñ 	÷5ñ 5÷
kñ kð\€ð(:Ð ôx	�lô 	õ:'õxð Ð6Ø
‰NðPÐ "Ð$Ló ô	˜iô 	òô' §¡× 4Ñ 4× HÑ Hô 'ô51Ð3ô 51ðz ×Ññó ðôA5Ð0ô A5òHY÷Tñ Tò&÷ #ñ #ô<�t—y‘yô òBRð 
‡I�I‡N�N×Ñ×!Ñ!ð 
‡I�I‡N�N×Ñ×!Ñ!ðñ ˆ×Ñ×+Ñ+×<Ñ<×IÑIÓJõK€òô"_Ð 1ô _ñB ‹X€
Ù‹H€	ðð ô/YÐ0ô /YôdSðt ØFUØ6ØØñð 04÷ð ð8Að
 ðAð GVðAð 7ðAð ðAð ðAð 04÷A÷H0ó 0r$   