+
    –°³jÏ(  ã            	       óŠ  € ^ RI t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	H
t
 ^ RIHtHt ^ RIt^ RIHt ^ RIHt ^ RIHt ]! R	R
R7      t]! R4      tRR lt]! 4       t]! 4       t ! R R4      t]! RRR
R7      t]! R]P8                  ]]P8                  ,          4      t ! R R]
]	]]]3,          4      t]3R R llt R R lt!R# )é    N)ÚOrderedDict)ÚCallable©Úwraps)ÚConcatenateÚGenericÚProtocol)Ú	ParamSpecÚTypeVar)Ú_State)Ú_get_root_modulesÚ_TT)Ú	covariantÚ_Pc                 óH   € V  R \        \        P                  ! 4       4       2# )Ú_)ÚstrÚuuidÚuuid4)Ústrings   &Úg/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributed/_composable/contract.pyÚgenerate_state_keyr      s   € ØˆX�Q”sœ4Ÿ:š:›<Ó(Ð)Ð*Ð*ó    c                   ó   € ] tR t^tRtR# )ÚRegistryItem© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   r   r   r   r      s   † Ûr   r   Ú_TStater   )Úboundr   Ú_Mc                   óD   a € ] tR t^'t o V 3R lR ltV 3R lR ltRtV tR# )Ú_ContractFnc                óT   <€ V ^8„  d   QhRS[ P                  RS[ P                  RS[/# )é   ÚargsÚkwargsÚreturn)r   r)   r*   r   )ÚformatÚ__classdict__s   "€r   Ú__annotate__Ú_ContractFn.__annotate__(   s    ø€ ×FÑF™bŸg™gÐF±·±ÐF¹rÑFr   c                ó   € R # ©Nr   )Úselfr)   r*   s   &*,r   Ú__call__Ú_ContractFn.__call__(   s   € Á3r   c                ó:   <€ V ^8„  d   QhRS[ P                  RS[/# ©r(   Úmoduler+   )ÚnnÚModuler"   )r,   r-   s   "€r   r.   r/   *   s   ø€ ×6Ñ6™BŸI™IÐ6©'Ñ6r   c                ó   € R # r1   r   )r2   r7   s   &&r   ÚstateÚ_ContractFn.state*   s   € ±3r   r   N)r   r   r   r    r3   r;   r!   Ú__classdictcell__)r-   s   @r   r&   r&   '   s   ø‡ € ßFÐFç6Ö6r   r&   c          	      óü   € V ^8„  d   QhR\         \        ,          R\        \        \        \        \
        3,          \        3,          .\        \        \        \
        3,          \        \        3,          3,          /# )r(   Ú	state_clsr+   )Útyper"   r   r   r$   r   r&   )r,   s   "r   r.   r.   -   s_   € ÷ Dñ DÜ”G�}ðDäÜŒkœ"œb˜&Õ!¤2Ð%Õ&Ð'Ü”œB¤˜FÕ#¤R¬Ð0Õ1ð3õñDr   c                ó6   a € \        S 4      R V 3R ll4       pV# )a™  
Decorate a function as a composable distributed API, where the first
argument of the function must be an :class:`nn.Module` instance or sequence
of :class:`nn.Module` instances.

The decorator verifies that the decorated function does not modify
fully-qualified names (FQNs) for parameters, buffers, or modules. The
decorated function can return different module instances than the input
modules; the FQN invariant will be enforced following the input order.

When a function ``func`` is decorated by ``@contract()``, a
``.state(module: nn.Module)`` method will be installed to the decorated
function. Then you can retrieve and modify the state on a module by calling
``func.state(module)``.

Example::
    >>> # xdoctest: +SKIP
    >>> import torch.nn as nn
    >>>
    >>> class MyModel(nn.Module):
    >>>     def __init__(self) -> None:
    >>>         super().__init__()
    >>>         self.l1 = nn.Linear(10, 10)
    >>>         self.l2 = nn.Linear(10, 10)
    >>>
    >>>     def forward(self, x):
    >>>         return self.l2(self.l1(x))
    >>>
    >>> @contract()
    >>> def my_feature(module: nn.Module) -> nn.Module:
    >>>     my_feature.state(module).some_state = "any value"
    >>>     return module
    >>>
    >>> model = MyModel()
    >>> my_feature(model.l1)
    >>> assert my_feature.state(model.l1).some_state == "any value"
    >>> my_feature(model.l2)
    >>> model(torch.randn(2, 10)).sum().backward()
c                óÂ   € V ^8„  d   QhR\         \        \        \        3,          \        3,          R\        \        \        \        3,          \        \
        3,          /# )r(   Úfuncr+   )r   r   r$   r   r&   r"   )r,   s   "r   r.   Úcontract.<locals>.__annotate__]   sH   € ÷ Rñ RÜ”{¤2¤r 6Õ*¬BÐ.Õ/ðRä	”[¤¤R Õ(¬"¬gÐ5Õ	6ñRr   c                 óX   <a € \        S 4      R  V V3R ll4       pR V 3R llpW!n        V# )c                óp   € V ^8„  d   QhR\         R\        P                  R\        P                  R\         /# )r(   r7   r)   r*   r+   )r$   r   r)   r*   )r,   s   "r   r.   Ú-contract.<locals>.inner.<locals>.__annotate__a   s>   € ÷ D	ñ D	ÜðD	ä—7‘7ðD	ô —i‘iðD	ô ñ	D	r   c                 ó¢  <€ T p\        V \        P                  4      '       d   V .pM\        \	        V 4      4      pS! 4       p\        4       p. p. p. p	V EFy  p \        4       p
\        4       pV P                  P                  \        V
4      p\        V\        4      '       g   \        R V 24      hV P                  P                  \        V4      p\        V\        4      '       g   \        RV 24      hSV9   g   SP                  V9   d   \        RSP                   RV  24      hVP                  SV4       VP                  SP                  V4       VP                  \        V P                  4       4      4       VP                  \        V P!                  4       4      4       V	P                  \        V P#                  4       4      4       EK|  	  S! V.VO5/ VB pVf   Tp\        V\        P                  4      '       d   V.pM\        \	        V4      4      p. p. p. pV F{  p VP                  \        V P                  4       4      4       VP                  \        V P!                  4       4      4       VP                  \        V P#                  4       4      4       K}  	  \%        V	4      p\%        V4      pVV8w  d   \        SP                   RV RV R24      hR R lp\'        VV4       F>  w  ppV! \	        VP)                  4       4      \	        VP)                  4       4      R	4       K@  	  \'        VV4       F>  w  ppV! \	        VP)                  4       4      \	        VP)                  4       4      R
4       K@  	  \'        V	V4       F>  w  ppV! \	        VP)                  4       4      \	        VP)                  4       4      R4       K@  	  V# )z-Distributed composable API states corrupted: z/Distributed composable API registry corrupted: zOEach distinct composable distributed API can only be applied to a module once. z3 has already been applied to the following module:
zB should return the same number of modules as input modulesInputs: z modules
Outputs: z modulesc                óh   € V ^8„  d   QhR\         \        ,          R\         \        ,          R\        /# )r(   Ú	orig_fqnsÚnew_fqnsÚ	check_key)Úlistr   )r,   s   "r   r.   Ú>contract.<locals>.inner.<locals>.wrapper.<locals>.__annotate__²   s*   € ÷ ñ ¤T¬#¥Yð ¼$¼s½)ð ÔPSñ r   c                 óì   € W8X  d   R # \        V 4      \        V4      rCW4,
          pWC,
          p\        V4      '       g   \        V4      '       d   \        V RV RV 24      h\        V RV RV 24      h)NzVComposable distributed API implementations cannot modify FQNs.
FQNs only in original: z
FQNs only in new: z[Composable distributed API implementations cannot modify the order of FQNs.
Original FQNs: z
New FQNs: )ÚsetÚlenÚRuntimeError)rJ   rK   rL   Úorig_fqn_setÚnew_fqn_setÚ	orig_onlyÚnew_onlys   &&&    r   Ú	check_fqnÚ;contract.<locals>.inner.<locals>.wrapper.<locals>.check_fqn²   s“   € ØÔ(Ùä,/°	«N¼CÀ»M˜kØ(Õ6�	Ø&Õ5�Ü�y—>’>¤S¨§]¢]Ü&Ø$˜+ð2Ø2;°ð =-Ø-5¨Jð8óð ô 'Ø$˜+ð*à*3¨ð 5%Ø%- Jð	0óð r   zChecking parameters: zChecking buffers: zChecking modules: )Ú
isinstancer8   r9   r   rM   r   r   Ú__dict__Ú
setdefaultÚ	STATE_KEYÚdictÚAssertionErrorÚREGISTRY_KEYr   ÚappendÚnamed_parametersÚnamed_buffersÚnamed_modulesrQ   ÚzipÚkeys)r7   r)   r*   Ú
inp_moduleÚmodulesr;   Úregistry_itemÚall_orig_named_paramsÚall_orig_named_buffersÚall_orig_named_modulesÚdefault_all_stateÚdefault_registryÚ	all_stateÚregistryÚupdatedÚupdated_modulesÚall_new_named_paramsÚall_new_named_buffersÚall_new_named_modulesÚnum_orig_modulesÚnum_new_modulesrW   Úorig_named_paramsÚnew_named_paramsÚorig_named_buffersÚnew_named_buffersÚorig_named_modulesÚnew_named_modulesrC   r?   s   &*,                         €€r   ÚwrapperÚ(contract.<locals>.inner.<locals>.wrapper`   s¯  ø€ ð  ˆJä˜&¤"§)¡)×,Ò,Ø!˜(‘ô ,¬D°«LÓ9�Ù“KˆEÜ(›NˆMð
 DFÐ!ØDFÐ"ØACÐ"ä!�Ü<G»MÐ!Ü<G»MÐ Ø4:·O±O×4NÑ4NÜÐ0ó5�	ô " )¬T×2Ò2Ü(ØGÈ	À{ÐSóð ð 5;·O±O×4NÑ4NÜ Ð"2ó5�ô " (¬D×1Ò1Ü(ØIÈ(ÈÐTóð ð ˜9Ô$¨¯©¸Ô(AÜ(ð(Ø(,¯© ð 7.Ø.4¨Xð7óð ð
 ×$Ñ$ T¨5Ô1Ø×#Ñ# D§M¡M°=ÔAà%×,Ñ,¬[¸×9PÑ9PÓ9RÓ-SÔTØ&×-Ñ-¬k¸&×:NÑ:NÓ:PÓ.QÔRØ&×-Ñ-¬k¸&×:NÑ:NÓ:PÓ.Q×Rñ9 "ñ< ˜:Ð7¨Ò7°Ñ7ˆGØŠØ$�ä˜'¤2§9¡9×-Ò-Ø#* )‘ä"3´D¸Ó4DÓ"E�àBDÐ ØCEÐ!Ø@BÐ!Û)�Ø$×+Ñ+¬K¸×8OÑ8OÓ8QÓ,RÔSØ%×,Ñ,¬[¸×9MÑ9MÓ9OÓ-PÔQØ%×,Ñ,¬[¸×9MÑ9MÓ9OÓ-PÖQñ *ô
  #Ð#9Ó:ÐÜ!Ð"7Ó8ˆOØ ?Ô2Ü$Ø—}‘}�oð &Ø/Ð0ð 1 Ø /Ð0°ð:óð õô. 8;Ø%Ð';ö8Ñ3Ð!Ð#3ñ ÜÐ*×/Ñ/Ó1Ó2ÜÐ)×.Ñ.Ó0Ó1Ø+öñ8ô :=Ø&Ð(=ö:Ñ5Ð"Ð$5ñ ÜÐ+×0Ñ0Ó2Ó3ÜÐ*×/Ñ/Ó1Ó2Ø(öñ:ô :=Ø&Ð(=ö:Ñ5Ð"Ð$5ñ ÜÐ+×0Ñ0Ó2Ó3ÜÐ*×/Ñ/Ó1Ó2Ø(öñ:ð ˆNr   c                óD   € V ^8„  d   QhR\         P                  R\        /# r6   )r8   r9   r   )r,   s   "r   r.   rG   ç   s   € ÷ 	ñ 	œbŸi™ið 	¬Fñ 	r   c                 ób   <€ V P                   P                  \        / 4      P                  S4      # r1   )rZ   r[   r\   Úget)r7   rC   s   &€r   Ú	get_stateÚ*contract.<locals>.inner.<locals>.get_stateç   s+   ø€ Ø—?‘?×-Ñ-ÜØó÷ ‰c�$‹iðr   )r   r;   )rC   r}   r‚   r?   s   f  €r   ÚinnerÚcontract.<locals>.inner\   s:   ù€ ô 
ˆt‹÷D	ð D	ó 
ðD	÷L	ð 	ð "Œàˆr   r   )r?   r„   s   f r   Úcontractr†   -   s'   ø€ ô^ ˆ9Ó÷Ró ðRðh €Lr   c                ót   € V ^8„  d   QhR\         P                  R\        \        \        3,          R,          /# )r(   r7   r+   N)r8   r9   r]   r   r   )r,   s   "r   r.   r.   ô   s-   € ÷ /ñ /œ"Ÿ)™)ð /¬¬S´,Ð->Õ(?À$Õ(Fñ /r   c                ó$   € \        V \        R4      # )z¦
Get an ``OrderedDict`` of composable APIs that have been applied to the
``module``, indexed by the API name. If no API has been applied, then this
returns ``None``.
N)Úgetattrr_   )r7   s   &r   Ú_get_registryrŠ   ô   s   € ô �6œ<¨Ó.Ð.r   )Ú__composable_api_state_key)"r   Úcollectionsr   Úcollections.abcr   Ú	functoolsr   Útypingr   r   r	   Útyping_extensionsr
   r   ÚtorchÚtorch.nnr8   Ú#torch.distributed._composable_stater   Útorch.distributed.utilsr   r   r   r   r\   r_   r   r"   r9   rM   r$   r&   r†   rŠ   r   r   r   Ú<module>r•      s²   ðã Ý #Ý $Ý ß 1Ñ 1ß 0ã Ý Ý 6Ý 5ñ ˆT˜TÔ"€Ùˆtƒ_€ô+ñ Ó €	Ù!Ó#€÷	ñ 	ñ �) 8°tÔ
<€ÙˆT�2—9‘9˜d 2§9¡9�oÓ.€ô7�(˜G B¨¨G OÕ4ô 7ð  &÷D÷N/r   