
    :i                        U d dl mZ d dlmZ d dlZd dlmZ d dlmZ d dl	m
Z
 g dZ ed          d	ed
edefd            Zej        j        j        j        dddgefej        j        j        j        dg defej        j        j        j        dg defej        j        j        j        dg efej        j        j        j        dg defej        j        j        j        ddgefiZeeeeee         eeegef         f         f         e d<    ed          dej!        deeef         fd            Z" ed          de
ddfd            Z#dS )    )Callable)AnyN)compatibility)GraphModule)default_matchingextract_attrs_for_loweringlift_lowering_attrs_to_nodesF)is_backward_compatiblenametarget_versionreturnc                     | S )zDefault matching method )r   r   s     N/var/www/icac/venv/lib/python3.11/site-packages/torch/fx/passes/param_fetch.pyr   r      s	     K       weightbias)r   r   kernel_sizestridepaddingdilationgroupspadding_mode   )r   r   running_meanrunning_vareps)r   r   r   r   return_indices	ceil_modeinplacemodule_fetch_bookmodc           	         i }t          j        |           |d<   t          |           t          v rt          t          |                    \  }}}|| j        k     r0t          d| dt          j        |            d| j         d          |D ]$}t          |  ||| j                            ||<   %n$t          t          j        |            d          |S )zIf `mod` is in `module_fetch_book`, fetch the mod's attributes that in the `module_fetch_book`
    after checking module's version is compatible with the `module_fetch_book`.
    r   zFetcher version z try to fetch z	 version zl, please upgrade the module_fetch_book, open an issue and @842974287 or report a bug to AIACC team directly.z is not in the module_fetch_book yet, please add it to the module_fetch_book, open an issue and @842974287 or report a bug to AIACC team directly.)torchtypenametyper"   _versionRuntimeErrorgetattr)r#   attrs_for_loweringversionparam_to_fetchmatching_methodattrs         r   r   r   :   s   
 *,!&!4!4vCyy%%%3DT#YY3O0S\!!:7 : :%.:M:M : :X[Xd : : :  
 # 	Y 	YD'.sOOD#,4W4W'X'Xt$$	Y ~c"" 6 6 6
 
 	

 r   	fx_modulec                 0   t          |                                           }| j        j        D ]g}|j        dk    rZt          ||j                 t                    rt          ||j                            Ht          ||j                           |_
        hdS )zjRecursively traverse all `fx_module` nodes and fetch the module's attributes if the node is a leaf module.call_moduleN)dictnamed_modulesgraphnodesop
isinstancetargetr   r	   r   r+   )r0   
submodulesnodes      r   r	   r	   U   s     i--//00J%  7m##*T[1;?? ,Z-DEEEE*Dt{++ +' r   )$collections.abcr   typingr   r%   torch.nnnntorch.fx._compatibilityr   torch.fx.graph_moduler   __all__strintr   moduleslinearLinearconvConv2d	batchnormBatchNorm2dpoolingAdaptiveAvgPool2d	MaxPool2d
activationReLUr"   r3   r'   tuplelist__annotations__Moduler   r	   r   r   r   <module>rU      sQ   $ $ $ $ $ $ $              1 1 1 1 1 1 - - - - - -   e,,,3      -, 
H"Q6(:<L$M	H 			
 		
 		
 	# 
H*	@@@-
 
H.B8H0I	H&	WWW)
 
H$q9+7G&H7S 4eCcHc3Z_4M$MNNO   > e,,,BI $sCx.    -,4 e,,,K D    -,  r   