+
    –°³jFZ  ã                   óö  € ^ RI t ^ RIt^ RIHtHt ^ RIHtHtHtH	t	 ^ RI
HtHt ^ RIHt . R*OtR R ltR	 R
 ltR R ltR R lt ! R R]4      tR R lt ! R R]4      t ! R R]4      tR R ltR R ltR R ltR R lt]! R4      RR3R R llt]P<                  ]P>                  0]n         ]PB                  0]n"        ] PF                  R  R! l4       t$R" R# lt%R$ R% lt&R+R& R' llt' ! R( R)4      t(R# ),é    N)ÚABCÚabstractmethod)ÚCallableÚ	GeneratorÚIterableÚSequence)ÚAnyÚcastÚCustomPolicyÚModuleWrapPolicyc                óž   € V ^8„  d   QhR\         P                  R\        \         P                  .\         P                  R,          3,          /# )é   Úroot_moduleÚfnN©ÚnnÚModuler   )Úformats   "Ú\/home/luca/screen-checking/.venv/lib/python3.14/site-packages/torch/distributed/fsdp/wrap.pyÚ__annotate__r      s9   € ÷ )3ñ )3Ü—‘ð)3ä”"—)‘)�œbŸi™i¨$Õ.Ð.Õ/ñ)3ó    c                ó<   aaa€ V 0oR VVV3R lloS! V RR4       R# )a9  
This applies ``fn`` to every module in the module tree of ``root_module``
following a post-order traversal. If ``fn`` returns an :class:`nn.Module`,
then this replaces the original module with the newly returned one in the
tree. Otherwise, ``fn`` should return ``None``, in which case the module is
not changed.
c                ór   € V ^8„  d   QhR\         P                  R\        R\         P                  R,          /# )r   ÚmoduleÚmodule_nameÚparent_moduleN)r   r   Ústr)r   s   "r   r   Ú'_post_order_apply.<locals>.__annotate__-   s8   € ÷ Añ AÜ—	‘	ðAäðAô —y‘y 4Õ'ñAr   c                 óž  <€ V P                  4        F(  w  r4VS9  g   K  SP                  V4       S! WCV 4       K*  	  S! V 4      pVe„   \        V\        P                  4      '       g   \        RV RV  24      hV'       g   \        RV  24      h\        V\        P                  4      '       g   \        RV 24      h\        W!V4       R # R # )Nz=Non-root modules should have their parent module set but got z for zTNon-root modules should have their module name set but got an empty module name for z.fn should return None or an nn.Module but got )Únamed_childrenÚaddÚ
isinstancer   r   ÚAssertionErrorÚsetattr)	r   r   r   Úchild_module_nameÚchild_moduleÚoptional_moduleÚ_post_order_apply_innerr   Úvisited_moduless	   &&&   €€€r   r(   Ú2_post_order_apply.<locals>._post_order_apply_inner-   sÜ   ø€ ð
 06×/DÑ/DÖ/FÑ+ÐØ ?Ö2Ø×#Ñ# LÔ1Ù'¨ÈÖPñ 0Gñ ˜V›*ˆØÒ&Ü˜m¬R¯Y©Y×7Ò7Ü$ØSØ$�o U¨6¨(ð4óð ÷ Ü$ð0Ø06¨xð9óð ô ˜o¬r¯y©y×9Ò9Ü$ØDÀ_ÐDUÐVóð ô �M°Ö@ñ 'r   Ú N© )r   r   r(   r)   s   &f@@r   Ú_post_order_applyr-      s&   ú€ ð (3 m€O÷Aò Añ6 ˜K¨¨TÖ2r   c                ó  € V ^8„  d   QhR\         P                  R\        \         P                  \        \        \        3,          3,          R\
        R\
        \         P                  .\         P                  R,          3,          /# )r   r   Útarget_module_to_kwargsÚfsdp_fnÚreturnN)r   r   Údictr   r	   r   )r   s   "r   r   r   K   sc   € ÷ ñ Ü—‘ðä!¤"§)¡)¬T´#´s°(­^Ð";Õ<ðô ðô Œr�y‰yˆkœ2Ÿ9™9 tÕ+Ð+Õ,ñ	r   c                ó"   a aa€ R VV V3R llpV# )z¦
This constructs the "wrap" function to pass to :func:`_post_order_apply`
based on ``target_module_to_kwargs``, which should be constructed from the
wrapping policy.
c                óf   € V ^8„  d   QhR\         P                  R\         P                  R,          /# )r   r   r1   N)r   r   )r   s   "r   r   Ú(_construct_wrap_fn.<locals>.__annotate__V   s'   € ÷ ñ ”2—9‘9ð ¤§¡¨TÕ!1ñ r   c                 óF   <€ V S9   d   V SJd   SV ,          pS! V 3/ VB # R # ©Nr,   )r   Úkwargsr0   r   r/   s   & €€€r   r   Ú_construct_wrap_fn.<locals>.fnV   s2   ø€ ð Ð,Ô,°¸{Ó1JØ,¨VÕ4ˆFÙ˜6Ñ, VÑ,Ð,Ùr   r,   )r   r/   r0   r   s   fff r   Ú_construct_wrap_fnr:   K   s   ú€ ÷ò ð €Ir   c                óL  € V ^8„  d   QhR\         P                  R\        \        \         P                  ,          ,          R\        \         P                  ,          R\
        \        \        3,          R\
        \         P                  \
        \        \        3,          3,          /# )r   r   Úmodule_classesÚignored_modulesÚroot_kwargsr/   )r   r   r   ÚtypeÚsetr2   r   r	   )r   s   "r   r   r   a   sq   € ÷ #ñ #Ü—‘ð#äœT¤"§)¡)�_Õ-ð#ô œŸ™•^ð#ô ”cœ3�h•ð	#ô
 "¤"§)¡)¬T´#´s°(­^Ð";Õ<ñ#r   c                 ó¼   € \        \        V4      4      pV P                  4        F3  pWb9   d   K  \        We4      '       g   K  Wd9  d   W4V&   R WF,          R&   K5  	  V# )NÚmixed_precision)Útupler@   Úmodulesr"   )r   r<   r=   r>   r/   Úmodule_classes_tupler   s   &&&&&  r   Ú$_run_mixed_precision_override_policyrF   a   s`   € ô !¤ ^Ó!4Ó5ÐØ×%Ñ%Ö'ˆØÔ$ÙÜ˜×5Ô5àÔ4à2=¨Ñ/ØAEÐ#Õ+Ð,=Ó>ñ (ð #Ð"r   c                ó$   € V ^8„  d   QhR\         /# ©r   r1   )Úbool)r   s   "r   r   r   u   s   € ÷ ñ ¬4ñ r   c                 ó   € R# )zš
A simple recursive wrap policy that always returns ``True``. This means
that every submodule is wrapped by the wrapper class in
:func:`_recursive_wrap`.
Tr,   )Úargsr8   s   *,r   Úalways_wrap_policyrL   u   s   € ñ r   c                   ó@   a € ] tR t^~t o Rt]V 3R lR l4       tRtV tR# )Ú_Policyz_
This defines an abstract base class that represents a policy for applying
a module-level API.
c                óÀ   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[S[S[3,          RS[S[ P                  S[S[S[3,          3,          /# ©r   r   r=   r>   r1   ©r   r   r@   r2   r   r	   )r   Ú__classdict__s   "€r   r   Ú_Policy.__annotate__…   s]   ø€ ÷ 
ñ 
á—Y‘Yð
ñ ™RŸY™Y�ð
ñ ™#™s˜(•^ð	
ñ
 
‰b�i‰i™™c¡3˜h�Ð'Õ	(ñ
r   c                ó   € R# )zp
This should return a dict ``target_module_to_kwargs`` that maps from
each target module to wrap to its kwargs.
Nr,   )Úselfr   r=   r>   s   &&&&r   Ú_run_policyÚ_Policy._run_policy„   s   € ñ 	r   r,   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rV   Ú__static_attributes__Ú__classdictcell__©rR   s   @r   rN   rN   ~   s   ø‡ € ñð
 ÷
ó ö
r   rN   c          
      ó¨   € V ^8„  d   QhR\         P                  R\        R\        R\        \
        \         P                  ,          ,          R\        /# )r   r   ÚrecurseÚnonwrapped_numelr<   r1   ©r   r   rI   Úintr@   r?   )r   s   "r   r   r   ’   sK   € ÷ 5ñ 5Ü�I‰Ið5äð5ô ð5ô œœRŸY™Y�Õ(ð	5ô
 
ñ5r   c                ó@   € V'       d   R# \        V \        V4      4      # )a¸  
This auto wrap policy wraps every module that is an instance of any type in
``module_classes`` as its own FSDP instance. The root module given by
``module`` is always wrapped as an FSDP instance regardless. Since the
wrapping proceeds bottom up, each FSDP instance manages the parameters in
its subtree excluding any already managed by a child FSDP instance.

Args:
    module (nn.Module): Current module being considered.
    recurse (bool): If ``False``, then this function must decide whether
        ``module`` should be wrapped as an FSDP instance or not. If
        ``True``, then the function is still recursing down the module
        tree as a part of the DFS.
    nonwrapped_numel (int): Parameter numel not yet wrapped.
    module_classes (Set[Type[nn.Module]]): Set of module classes that are
        wrapped as FSDP instances.

Returns:
    ``True`` if ``recurse=True``, and whether ``module`` should be wrapped
    if ``recurse=False``.
T©r"   rC   )r   ra   rb   r<   s   &&&&r   Ú_module_wrap_policyrg   ’   s   € ÷6 ÙÜ�fœe NÓ3Ó4Ð4r   c                   ól   a a€ ] tR t^²t oRtV3R lR ltV3R lR ltR tV3R lV 3R lltR	t	Vt
V ;t# )
r   zo
This policy applies to every module of the specified module classes,
passing in the kwargs given to the root.
c                óT   <€ V ^8„  d   QhRS[ S[S[P                  ,          ,          /# )r   r<   )r   r?   r   r   )r   rR   s   "€r   r   ÚModuleWrapPolicy.__annotate__¸   s!   ø€ ÷ ;ñ ;¡x±±R·Y±YµÕ'@ñ ;r   c                óH   € \        V4      pW n        \        V4      V n        R # r7   )r@   Ú_module_classesr   Ú_module_classes_str)rU   r<   Úmodule_classes_sets   && r   Ú__init__ÚModuleWrapPolicy.__init__¸   s!   € Ü  Ó0ÐØ1ÔÜ#&Ð'9Ó#:ˆÖ r   c                óÀ   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[S[S[3,          RS[S[ P                  S[S[S[3,          3,          /# rP   rQ   )r   rR   s   "€r   r   rj   ½   s]   ø€ ÷ 'ñ 'á—Y‘Yð'ñ ™RŸY™Y�ð'ñ ™#™s˜(•^ð	'ñ
 
‰b�i‰i™™c¡3˜h�Ð'Õ	(ñ'r   c                óÈ   € \        V P                  4      p/ pVP                  4        F6  pWb9   d   K  \        Wd4      '       g   K  \        P                  ! V4      WV&   K8  	  V# r7   )rC   rl   rD   r"   Úcopy)rU   r   r=   r>   r<   r/   r   s   &&&&   r   rV   ÚModuleWrapPolicy._run_policy½   s[   € ô ˜t×3Ñ3Ó4ˆØCEÐØ!×)Ñ)Ö+ˆFØÔ(ÙÜ˜F×3Ô3ä26·)²)¸KÓ2HÐ'Ó/ñ ,ð 'Ð&r   c                ó2   € \        WRV P                  R7      # )é   )rb   r<   éÿÿÿÿ)rg   rl   )rU   r   ra   rK   r8   s   &&&*,r   Ú__call__ÚModuleWrapPolicy.__call__Í   s   € ä"Ø¨bÀ×AUÑAUô
ð 	
r   c                ó    <€ V ^8„  d   QhRS[ /# rH   )r   )r   rR   s   "€r   r   rj   Ó   s   ø€ ÷ Dñ D™#ñ Dr   c                óJ   <€ \         SV `  4       R V P                   R2,           # )Ú(Ú))ÚsuperÚ__repr__rm   )rU   Ú	__class__s   &€r   r   ÚModuleWrapPolicy.__repr__Ó   s&   ø€ Ü‰wÑÓ! a¨×(@Ñ(@Ð'AÀÐ$CÕCÐCr   )rl   rm   )rX   rY   rZ   r[   r\   ro   rV   rx   r   r]   r^   Ú__classcell__)r€   rR   s   @@r   r   r   ²   s5   ù‡ € ñ÷
;ð ;÷
'ð 'ò 
÷D÷ Dó Dr   c                   óH   a € ] tR t^×t o RtV 3R lR ltV 3R lR ltRtV tR# )r   a­  
This policy takes in a lambda function that maps a given ``nn.Module`` to
either ``False``, ``True``, or a kwarg dictionary.
- If the function returns ``False`` or an empty dictionary, then the module
  does not have the API applied.
- If the function returns ``True``, then the module has the API applied
  with the root's kwargs.
- If the function returns a non-empty dictionary, then the module has the
  API applied, and the dictionary overrides the root's kwargs.

Example::

    >>> # xdoctest: +SKIP("undefined variables")
    >>> model = init_transformer_model(...)
    >>> def lambda_fn(module: nn.Module):
    >>>     if module is model.lm_head:
    >>>         return {"sharding_strategy": ShardingStrategy.SHARD_GRAD_OP}
    >>>     elif isinstance(module, TransformerBlock):
    >>>         return True
    >>>     return False
    >>> policy = CustomPolicy(lambda_fn)
    >>> fsdp_model = FSDP(model, auto_wrap_policy=policy)
c                ór   <€ V ^8„  d   QhRS[ S[P                  .S[S[S[S[3,          ,          3,          /# )r   Ú	lambda_fn)r   r   r   rI   r2   r   r	   )r   rR   s   "€r   r   ÚCustomPolicy.__annotate__ð   s1   ø€ ÷ $ñ $¡(©B¯I©I¨;¹¹tÁCÉÀH½~Õ8MÐ+MÕ"Nñ $r   c                ó   € Wn         R # r7   ©Ú
_lambda_fn)rU   r…   s   &&r   ro   ÚCustomPolicy.__init__ð   s   € Ø#Žr   c                óÀ   <€ V ^8„  d   QhRS[ P                  RS[S[ P                  ,          RS[S[S[3,          RS[S[ P                  S[S[S[3,          3,          /# rP   rQ   )r   rR   s   "€r   r   r†   ó   s]   ø€ ÷ 'ñ 'á—Y‘Yð'ñ ™RŸY™Y�ð'ñ ™#™s˜(•^ð	'ñ
 
‰b�i‰i™™c¡3˜h�Ð'Õ	(ñ'r   c                óT  € / pVP                  4        F‘  pWR9   d   K  V P                  V4      p\        V\        \        34      '       g   \        R V 24      hV'       g   KP  \        P                  ! V4      p\        V\        4      '       d   VP                  V4       WtV&   K“  	  V# )z_The lambda_fn passed to CustomPolicy should return False/True or a kwarg dict, but it returned )rD   r‰   r"   r2   rI   Ú
ValueErrorrs   Úupdate)rU   r   r=   r>   r/   r   Úresr8   s   &&&&    r   rV   ÚCustomPolicy._run_policyó   s¦   € ð DFÐØ!×)Ñ)Ö+ˆFØÔ(ÙØ—/‘/ &Ó)ˆCÜ˜c¤D¬$ <×0Ò0Ü ðCØCFÀ%ðIóð ÷ ÙÜ—Y’Y˜{Ó+ˆFÜ˜#œt×$Ò$ð —‘˜cÔ"Ø.4 FÓ+ñ! ,ð" 'Ð&r   rˆ   N)	rX   rY   rZ   r[   r\   ro   rV   r]   r^   r_   s   @r   r   r   ×   s   ø‡ € ñ÷0$ð $÷'ö 'r   c          
      óh   € V ^8„  d   QhR\         P                  R\        R\        R\        R\        /# )r   r   ra   rb   r…   r1   )r   r   rI   rd   r   )r   s   "r   r   r     s8   € ÷ ñ Ü�I‰IðÜ $ðÜ8;ðÜHPðä	ñr   c                ó&   € V'       d   R# V! V 4      # )a  
A convenient auto wrap policy to wrap submodules based on an arbitrary user
function. If `lambda_fn(submodule) == True``, the submodule will be wrapped as
a `wrapper_cls` unit.

Return if a module should be wrapped during auto wrapping.

The first three parameters are required by :func:`_recursive_wrap`.

Args:
    module (nn.Module): Current module being considered.
    recurse (bool): If ``False``, then this function must decide whether
        ``module`` should be wrapped as an FSDP instance or not. If
        ``True``, then the function is still recursing down the module
        tree as a part of the DFS.
    nonwrapped_numel (int): Parameter numel not yet wrapped.

    lambda_fn (Callable[[nn.Module], bool]): If this returns ``True``, then
        this module will be wrapped.
Tr,   )r   ra   rb   r…   s   &&&&r   Úlambda_auto_wrap_policyr“     s   € ÷. ÙÙ�VÓÐr   c          
      ó¨   € V ^8„  d   QhR\         P                  R\        R\        R\        \
        \         P                  ,          ,          R\        /# )r   r   ra   rb   Útransformer_layer_clsr1   rc   )r   s   "r   r   r   *  sR   € ÷ Yñ YÜ�I‰IðYäðYô ðYô œt¤B§I¡I�Õ/ð	Yô
 
ñYr   c                ó   € \        WW#4      # )a  
See :func:`_module_wrap_policy`, where ``transformer_layer_cls`` is the
same as ``module_classes``. Note that shared parameters must be wrapped in
the same FSDP instance, so this auto wrap policy can help wrap shared
embeddings into the same FSDP instance for transformer models.
)rg   )r   ra   rb   r•   s   &&&&r   Útransformer_auto_wrap_policyr—   *  s   € ô ˜vÐ0@ÓXÐXr   c                óf   € V ^8„  d   QhR\         P                  R\        \        ,          R\        /# )r   r   r<   ra   )r   r   r   r?   rI   )r   s   "r   r   r   9  s,   € ÷ 	9ñ 	9Ü�I‰Ið	9Ü'/´¥~ð	9Ü@Dñ	9r   c                 ó@   € V'       d   R # \        V \        V4      4      # )Trf   )r   r<   ra   rK   r8   s   &&&*,r   Ú_wrap_module_cls_individuallyrš   9  s   € ÷ áô ˜&¤%¨Ó"7Ó8Ð8r   c                ó\   € V ^8„  d   QhR\         P                  R\        R\        R\        /# )r   r   ra   rb   r1   )r   r   rI   rd   )r   s   "r   r   r   E  s4   € ÷ ñ Ü�I‰Iðäðô ðô
 
ñr   c                ó„   a aa€ \         ;QJ d!    V VV3R lV 4       F  '       g   K   R# 	  R# ! V VV3R lV 4       4      # )zj
A policy that wraps ``module`` if any policy in the passed in iterable of
``policies`` returns ``True``.
c              3   ó:   <"  € T F  pV! SSSR 7      x € K  	  R# 5i)©r   ra   rb   Nr,   )Ú.0Úpolicyr   rb   ra   s   & €€€r   Ú	<genexpr>Ú_or_policy.<locals>.<genexpr>O  s%   øé € ð áˆFñ 	�f gÐ@P×QÑQÛùs   ƒTF)Úany)r   ra   rb   Úpoliciess   fff&r   Ú
_or_policyr¥   E  s@   ú€ ÷ ‹3ö áó�3Œ3ð Š3ð ˆ3ö áóó ð r   g    „×—Ac                ó  € V ^8„  d   QhR\         P                  R\        R\        R\        R\        \
        \         P                  ,          ,          R,          R\        \
        \         P                  ,          ,          R,          R\        /# )	r   r   ra   rb   Úmin_num_paramsÚforce_leaf_modulesNÚexclude_wrap_modulesr1   rc   )r   s   "r   r   r   U  s   € ÷ 3Pñ 3PÜ�I‰Ið3Päð3Pô ð3Pô
 ð3Pô œD¤§¡�OÕ,¨tÕ3ð3Pô œd¤2§9¡9�oÕ.°Õ5ð3Pô 
ñ3Pr   c                ó  € Vf   \         P                  MTpVf   \         P                  MTpTpW&8¬  pV'       d%   T;'       d    \        V \	        V4      4      '       * # T;'       d    \        V \	        V4      4      '       * # )a{  
A size-based auto wrap policy.

Args:
    module (nn.Module): Current module being considered.
    recurse (bool): If ``False``, then this function must decide whether
        ``module`` should be wrapped as an FSDP instance or not. If
        ``True``, then the function is still recursing down the module
        tree as a part of the DFS.
    nonwrapped_numel (int): Parameter numel not yet wrapped.

    min_num_params (int): Customizable policy input that controls the size
        threshold over which a module is ready to be wrapped. This is in
        units of numel.
    force_leaf_modules (Optional[set[type[nn.Module]]]): Set of module types to keep
        as leaves, i.e. their children will never be wrapped.
    exclude_wrap_modules (Optional[set[type[nn.Module]]]): Set of module types to be
        excluded in wrapping.

Returns:
    Whether ``module`` should be wrapped.
)Úsize_based_auto_wrap_policyÚFORCE_LEAF_MODULESÚEXCLUDE_WRAP_MODULESr"   rC   )r   ra   rb   r§   r¨   r©   Úmin_nonwrapped_numelÚis_larges   &&&&&&  r   r«   r«   U  sŠ   € ðB Ò%ô 	$×6Ò6àð ð  Ò'ô 	$×8Ò8à!ð ð *ÐØÑ7€Hßà×MÐM¤
¨6´5Ð9KÓ3LÓ MÔMÐMð ×OÐO¤
¨6´5Ð9MÓ3NÓ OÔOÐOr   c                óJ   € V ^8„  d   QhR\         R\         R\        R,          /# )r   Úwrapper_clsÚwrapper_kwargsr1   )NNN)r	   r   )r   s   "r   r   r   ‘  s*   € ÷  ñ  Üð Ü+.ð äÐÕ ñ r   c              +  ó‚   "  € RV /VCp\        R/ VB ;_uu_ 4        Rx € RRR4       R#   + '       g   i     R# ; i5i)a…  
Context manager to wrap modules using a wrapper.

Useful for when you'd like to apply the same configuration arguments to all
child modules that you wrap. A particularly important use case is wrapping
large layers so that they get sharded (in-place) during initialization, to
avoid running out of system memory. Large layers can indicate that they
should be sharded via the ``wrap`` annotation and this context manager can
provide the exact configuration for these nested instances.

Usage::

    with enable_wrap(wrapper_cls, **params):
        # Wraps layer in FSDP by default if within context
        self.l1 = wrap(torch.nn.Linear(5, 5))

Args:
    wrapper_cls:
        Class that `wrap` annotation will `wrap` modules with, such as
        `FullyShardedDataParallel`.
    **wrapper_kwargs:
        Configuration settings that will be passed to all ``wrap``
        instances inside the context
r±   Nr,   )Ú_ConfigAutoWrap)r±   r²   r8   s   $, r   Úenable_wraprµ   �  s<   é € ð: 	�{ðà
ð€Fô 
Ñ	"˜6×	"Ó	"Û÷ 
#×	"×	"Ò	"üs   ‚?œ+¡
?«<	¶	?c                ód   € V ^8„  d   QhR\         P                  R\        R\         P                  /# )r   r   Úwrap_overridesr1   )r   r   r	   )r   s   "r   r   r   ´  s)   € ÷ #ñ #”—‘ð #¬cð #´b·i±iñ #r   c                óÊ   € \         P                  '       dM   \         P                  f   \        R4      h/ \         P                  CVCp\        V \         P                  3/ VB # V # )aÓ  
Annotate that a module should be wrapped. Annotated modules will only be
wrapped if inside of an :func:`enable_wrap` context manager. This allows
a module to be initialized both with and without a wrapper without code
change.

The class that this function wraps the passed in ``nn.Module`` with is the
passed in ``wrapper_cls`` argument into ``enable_wrap``. Both
``enable_wrap`` and ``wrap`` can take in kwargs specifying how to construct
the ``wrapper_cls`` instance. In the case of duplicate kwargs in
``enable_wrap`` and ``wrap``, the argument passed into ``wrap`` will be
respected.

Usage::

    with enable_wrap(wrapper_cls=FSDP, **fsdp_config):
        # Wraps layer in FSDP by default if within context
        self.l1 = wrap(torch.nn.Linear(5, 5))

Args:
    module (nn.Module): module to wrap (if in :func:`enable_wrap` context)
    **wrap_overrides: configuration overrides that will take priority over
        the values provided by the :func:`enable_wrap` context
z.Expected _ConfigAutoWrap.wrapper_cls to be set)r´   Úin_autowrap_contextr±   r#   r8   Ú_wrap)r   r·   s   &,r   Úwrapr»   ´  sg   € ô2 ×*×*Ð*Ü×&Ñ&Ò.Ü Ð!QÓRÐRàEœO×2Ñ2ÐE°nÐEˆÜØÜ×'Ñ'ñ
ð ñ
ð 	
ð
 €Mr   c                ód   € V ^8„  d   QhR\         P                  R\        R\         P                  /# )r   r   r±   r1   r   )r   s   "r   r   r   Ú  s)   € ÷ )ñ )”"—)‘)ð )¬(ð )ÄÇÁñ )r   c                 óˆ   € Vf   \        R4      h\        V R4      '       d   / VCV P                  CpV! V 3/ VB # V! V 3/ VB # )NzExpected wrapper_cls to be setÚ_wrap_overrides)r#   Úhasattrr¾   )r   r±   r8   Ú	overridess   &&, r   rº   rº   Ú  sY   € ØÒÜÐ=Ó>Ð>ÜˆvÐ(×)Ò)ð
 9�vÐ8 ×!7Ñ!7Ð8ˆ	Ù˜6Ñ/ YÑ/Ð/á�vÑ( Ñ(Ð(r   c                ó  € V ^8„  d   QhR\         P                  R\        R\        R\        \         P                  ,          R\        \         P                  ,          R\
        R\        R\        \         P                  \        3,          /# )	r   r   Úauto_wrap_policyr±   r=   Úignored_paramsÚonly_wrap_childrenr8   r1   )	r   r   r   r@   Ú	ParameterrI   r	   rC   rd   )r   s   "r   r   r   è  s„   € ÷ Mñ MÜ�I‰IðMäðMô ðMô œŸ™•^ð	Mô
 œŸ™Õ%ðMô ðMô ðMô Œ2�9‰9”cˆ>ÕñMr   c                óš  a€ Vf   \        R4      hVf   \        R4      hV P                  4        F?  w  rxWƒ9   d   K   \        V\        \        V4      4      '       d   \        RV RV 24      hKA  	  \        V3R lV P                  4        4       4      p	Vf   \        R4      hV! V RV	R7      '       d�   ^ p
V P                  4        F8  w  r¸Wƒ9   d   K  \        RR	VR
VRVRVRS/VB w  rÍ\        WV4       W­,          p
K:  	  Wš,
          pV'       g    V! V RVR7      '       d   \        W3/ VB V	3# W
3# V ^ 3#   \
         d     EK  i ; i)až  
Wraps submodules of ``module`` for which ``auto_wrap_policy`` returns
``True`` with ``wrapper_cls``.

Args:
    module (nn.Module): Module to recursively wrap.
    auto_wrap_policy (Callable): A callable representing a policy that
        determines which modules to recursively wrap with ``wrapper_cls``.
    ignored_modules (set[torch.nn.Module]): Modules to ignore when
        wrapping.
    ignored_params (set[torch.nn.Parameter]): Parameters to ignore when
        wrapping; these should be the parameters contained in the modules
        in ``ignored_modules``.
Returns:
    (nn.Module, int):
        ``module`` after wrapping and the numel recursively wrapped.
zMust specify auto_wrap_policy.zMust specify wrapper_clszChild module z is already wrapped by c              3   óT   <"  € T F  qS9  g   K  VP                  4       x € K  	  R # 5ir7   )Únumel)rŸ   ÚprÃ   s   & €r   r¡   Ú"_recursive_wrap.<locals>.<genexpr>  s$   øé € ð Ù.�a¸>Ñ2IŒ	ˆ�‰�	ˆ	Ó.ùs   ƒ(�(z#Expected auto_wrap_policy to be setTrž   r   rÂ   r±   r=   rÃ   Fr,   )r#   Únamed_modulesr"   r
   r?   Ú	TypeErrorÚsumÚ
parametersr    Ú_recursive_wrapr$   rº   )r   rÂ   r±   r=   rÃ   rÄ   r8   Ú_Úchildrb   Útotal_wrapped_numelÚnameÚwrapped_childÚnum_wrapped_paramsÚ	remainders   &&&&f&,        r   rÏ   rÏ   è  s©  ø€ ð4 ÒÜÐ=Ó>Ð>ØÒÜÐ7Ó8Ð8à×(Ñ(Ö*‰ˆØÔ#Ùð	Ü˜%¤¤d¨KÓ!8×9Ò9Ü$Ø# E 7Ð*AÀ+ÀÐOóð ñ :ñ	 +ô ô Ø!×,Ñ,Ô.óó Ðð ÒÜÐBÓCÐCÙ˜v¨tÐFV×WÓWØÐà!×0Ñ0Ö2‰KˆDØÔ'ÙÜ0?ñ 1Øð1à!1ð1ð (ð1ð !0ð	1ð
  .ð1ð ñ1Ñ-ˆMô �F -Ô0àÕ5Òñ 3ð  %Õ:ˆ	ß!Ñ&6Ø 5¸9÷'
ó '
ô ˜Ñ7°Ñ7Ð9IÐIÐIàÐ.Ð.Ø�1ˆ9ÐøôM ô 	ãð	ús   ¾1D:Ä:E
Å	E
c                   óª   a € ] tR tRt o RtRtRt/ tV 3R lR lt]	V 3R lR l4       t
]	V 3R	 lR
 l4       tV 3R lR ltV 3R lR ltV 3R ltRtV tR# )r´   i8  z€
Helper class to wrap modules based on default config args via a context manager.
See :func:`enable_wrap` for more information.
FNc                ó6   <€ V ^8„  d   QhRS[ S[S[3,          /# )r   r8   )r2   r   r	   )r   rR   s   "€r   r   Ú_ConfigAutoWrap.__annotate__B  s   ø€ ÷ ñ ¡¡c©3 h¥ñ r   c                ó   € Wn         R # r7   ©r8   )rU   r8   s   &,r   ro   Ú_ConfigAutoWrap.__init__B  s   € ØŽr   c                ó$   <€ V ^8„  d   QhRS[ RR/# )r   r8   r1   N©r	   )r   rR   s   "€r   r   rÙ   F  s   ø€ ÷ (ñ (©ð (°ñ (r   c                óÞ   € \         P                  '       d   \        R 4      hR\         n        RV 9  d   \        R4      h\	        \
        V R,          4      \         n        V R V \         n        R# )z]You are already within an autowrap context and we currently do not supported nested autowrap.Tr±   z9Expected to pass in wrapper_cls arg into _ConfigAutoWrap.N)r´   r¹   ÚNotImplementedErrorr#   r
   r   r±   r8   rÛ   s   &r   Úenable_autowrap_contextÚ'_ConfigAutoWrap.enable_autowrap_contextE  sf   € ä×.×.Ð.Ü%Øoóð ð /3ŒÔ+à Ô&Ü ØKóð ô '+¬8°V¸MÕ5JÓ&KŒÔ#Ø�=Ð!à!'ŒÖr   c                ó   <€ V ^8„  d   QhRR/# ©r   r1   Nr,   )r   rR   s   "€r   r   rÙ   W  s   ø€ ÷ $ñ $ dñ $r   c                 óH   € R \         n        R\         n        / \         n        R# )FN)r´   r¹   r±   r8   r,   r   r   Údisable_autowrap_contextÚ(_ConfigAutoWrap.disable_autowrap_contextV  s   € à.3ŒÔ+Ø&*ŒÔ#Ø!#ŒÖr   c                ó   <€ V ^8„  d   QhRR/# rä   r,   )r   rR   s   "€r   r   rÙ   \  s   ø€ ÷ 2ñ 2˜4ñ 2r   c                ó<   € V P                  V P                  4       R # r7   )rá   r8   )rU   s   &r   Ú	__enter__Ú_ConfigAutoWrap.__enter__\  s   € Ø×$Ñ$ T§[¡[Ö1r   c                ó0   <€ V ^8„  d   QhRS[ RS[ RS[ RR/# )r   Úexc_typeÚexc_valÚexc_tbr1   NrÞ   )r   rR   s   "€r   r   rÙ   _  s)   ø€ ÷ (ñ (¡ð (©sð (¹Cð (ÀDñ (r   c                ó&   € V P                  4        R # r7   )ræ   )rU   rí   rî   rï   s   &&&&r   Ú__exit__Ú_ConfigAutoWrap.__exit___  s   € Ø×%Ñ%Ö'r   c                ób   <€ V ^8„  d   Qh/ S[ ;R&   S[R,          ;R&   S[S[S[3,          ;R&   # )r   r¹   Nr±   r8   )rI   r   r2   r   r	   )r   rR   s   "€r   r   rÙ   8  s8   ø‡ ‚ ñ Ñ%ñ ñ ˜D•Ñ'ñ ñ ‘‘c��NÑò r   rÛ   )rX   rY   rZ   r[   r\   r¹   r±   r8   ro   Ústaticmethodrá   ræ   rê   rñ   Ú__annotate_func__r]   r^   r_   s   @r   r´   r´   8  sj   ø‡ € ñð
 !&ÐØ#'€KØ€F÷ð ð ÷(ó ð(ð  ÷$ó ð$÷
2ð 2÷(ð (÷O ƒ r   r´   )rL   r“   r—   r«   rµ   r»   r   r   )F))Ú
contextlibrs   Úabcr   r   Úcollections.abcr   r   r   r   Útypingr	   r
   Útorch.nnr   Ú__all__r-   r:   rF   rL   rN   rg   r   r   r“   r—   rš   r¥   rd   r«   Ú
ModuleListÚ
ModuleDictr­   ÚMultiheadAttentionr¬   Úcontextmanagerrµ   r»   rº   rÏ   r´   r,   r   r   Ú<module>r      sò   ðó Û ß #ß CÓ Cß å ò	€õ)3õXõ,#õ(ôˆcô õ(5ô@"D�wô "DôJ4'�7ô 4'õnõ8Yõ	9õñ* ˜c›(Ø6:Ø8<÷3Pðn 57·M±MÀ2Ç=Á=Ð3QÐ Ô 0Ø24×2GÑ2GÐ1HÐ Ô .ð ×Ñô ó ð õF#õL)÷M÷`((ó ((r   