+
    –°³j  ã                   ól   € R t ^ RIt^ RIHt ^ RIHt ^ RIHtHt  R R lt	R R lt
R R	 ltR
 R ltR# )zú
NOTE: This file must be imported like
``import torch.distributed.fsdp._traversal_utils`` and not like
``from torch.distributed.fsdp._traversal_utils import ...`` to avoid circular
imports. For brevity, we may import the file as ``traversal_utils``.
N©Ú_get_registry)Ú
_FSDPStateÚ_get_module_fsdp_statec                óD   € V ^8„  d   QhR\         P                  R\        /# ©é   ÚmoduleÚreturn)ÚnnÚModuleÚbool)Úformats   "Úh/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributed/fsdp/_traversal_utils.pyÚ__annotate__r   "   s   € ÷ 'ñ 'œŸ	™	ð '¤dñ 'ó    c                ó.   € \        V 4      pVf   R# RV9  # )z9
Returns if ``module`` can compose with ``fully_shard``.
TÚ	replicater   )r	   Úregistrys   & r   Ú_composabler   "   s"   € ô
 ˜VÓ$€HØÒÙØ˜hÑ&Ð&r   c                ó¦   € V ^8„  d   QhR\         P                  R\        \        \        ,          \        \         P                  ,          3,          /# r   )r   r   ÚtupleÚlistr   )r   s   "r   r   r   0   s7   € ÷ -%ñ -%Ü�I‰Ið-%ä
Œ4”
ÕœT¤"§)¡)�_Ð,Õ-ñ-%r   c                óþ  € . p. p\        4       p\        4       p\        P                  ! V .4      pV'       dÅ   VP                  4       pVP	                  V4       \        V4      '       g   K<  \        \        VP                  4       4      4       F  pWt9  g   K  VP                  V4       K  	  \        V4      pVf   K�  Wƒ9  g   K—  VP	                  V4       VP                  V4       VP                  V4       KÌ  W3# )aÃ  
Returns a tuple containing:
1. A list of the ``_FSDPState`` instances in the module tree rooted at
``module`` without any duplicates and following the ``module.modules()``
traversal order (which is assumed to be depth-first).
2. A corresponding list of the modules owning the states in the first list.

For the wrapper code path, both returned lists are the same, each
containing all ``FullyShardedDataParallel`` instances. For the composable
code path, this returns a list of all composable state instances and a list
of the corresponding fully sharded modules. See [Note: Fully Sharded
Module].

NOTE: The traversal does not proceed into any module annotated by an
incompatible API (e.g. ``replicate``).
)ÚsetÚcollectionsÚdequeÚpopleftÚaddr   Úreversedr   ÚchildrenÚ
appendleftr   Úappend)	r	   Úfsdp_statesÚfsdp_modulesÚvisited_fsdp_statesÚvisited_modulesr   Ú	submoduleÚchild_moduleÚoptional_states	   &        r   Ú_get_fsdp_states_with_modulesr*   0   sÛ   € ð& %'€KØ$&€Lô ,/«5Ðô '*£e€Oô
 +6×*;Ò*;¸V¸HÓ*E€Eß
Ø—M‘M“Oˆ	Ø×Ñ˜IÔ&Ü˜9×%Ò%ÙÜ$¤T¨)×*<Ñ*<Ó*>Ó%?Ö@ˆLØÖ2Ø× Ñ  Ö.ñ Aô 0°	Ó:ˆØÔ%¨.Ö*SØ×#Ñ# NÔ3Ø×Ñ˜~Ô.Ø×Ñ 	Ö*ØÐ$Ð$r   c                óZ   € V ^8„  d   QhR\         P                  R\        \        ,          /# r   )r   r   r   r   )r   s   "r   r   r   `   s#   € ÷ ñ œRŸY™Yð ¬4´
Õ+;ñ r   c                ó    € \        V 4      w  rV# )z*See :func:`_get_fsdp_states_with_modules`.)r*   )r	   r#   Ú_s   &  r   Ú_get_fsdp_statesr.   `   s   € ä2°6Ó:�N€KØÐr   c                óD   € V ^8„  d   QhR\         P                  R\        /# r   )r   r   r   )r   s   "r   r   r   f   s   € ÷ 
ñ 
œbŸi™ið 
¬Dñ 
r   c                óx   € \        V 4       Uu. uF  pVP                  f   K  VP                  NK!  	  ppV# u upi )z{
Returns all ``FlatParamHandle`` s in the module tree rooted at ``module``
following the rules in :func:`_get_fsdp_state`.
)r.   Ú_handle)r	   Ú
fsdp_stateÚhandless   &  r   Ú_get_fsdp_handlesr4   f   sF   € ô +¨6Ô2óá2ˆJØ×Ñô 	ˆ
×ÔÙ2ð ð ð
 €Nùòs   Ž7£7)Ú__doc__r   Útorch.nnr   Ú&torch.distributed._composable.contractr   Ú$torch.distributed.fsdp._common_utilsr   r   r   r*   r.   r4   © r   r   Ú<module>r:      s2   ðñó å Ý @ß Sðõ&'õ-%õ`÷
r   