+
    &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   "s/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/distributed/fsdp/wrap.py__annotate__r      s9     )3 )3)3"))bii$../)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 yy4'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*&mRYY77$S$oU6(4  $006x9  oryy99$D_DUV  M@ 'r    N )r   r   r(   r)   s   &f@@r   _post_order_applyr-      s&     (3mO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(^";<  ryyk299t++,	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'      299 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4F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"))_-# ^# c3h	#
 ""))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42=/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]     
 
YY
 RYY
 #s(^	

 
biic3h'	(
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II55 5 RYY(	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 feN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RYY'@ ;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]     ' 'YY' RYY' #s(^	'
 
biic3h'	('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326))K2H'/ , '&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AUAU
 	
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     $ $(BII;tC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]     ' 'YY' RYY' #s(^	'
 
biic3h'	('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cD$<00 CCF%I  YY{+F#t$$ c".4F+! ," '&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      II $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IIYY Y tBII/	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     v0@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II	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      II 
 
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 	fg@PQQs   TF)any)r   ra   rb   policiess   fff&r   
_or_policyr   E  s@     3 33 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II3P3P 3P
 3P DO,t33P d299o.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!  *7HMM
659K3L MMM OO
659M3N 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 #bii #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EO22En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())
 9v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IIMM M ^	M
 %M M M 299c>Mr   c                  a Vf   \        R4      hVf   \        R4      hV P                  4        F?  w  rxW9   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  rW9   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((*#	%dK!899$#E7*A+O  :	 +  !,,.  BCCvtFVWW!002KD'0? 11!11 (1 !0	1
  .1 1-M F-05 3  %:	!&659'
 '
 779III..19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      c3h 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  '+8VM5J&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 24 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  	)3X,#(c (5@"Dw "DJ4'7 4'n8Y	9* c(6:8<3Pn 57MM2==3Q  0242G2G1H  .    F#L)M`(( ((r   