o
    I&iQ4                     @   sV  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl	Z	d dl
Z
d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlmZ d dlZd dl Zd dl!Zd dl"Zddl#m$Z$ ddl%m&Z&m'Z'm(Z( 	 g eeeeeeee	e
eeeeeeeeeeeeeeeeeeeee eR Z)dZ*dd Z+d	ej,fd
dZ-h dZ.h dZ/ej01 re/h dO Z/h dZ2ej01 re23d e23d e	4ddd Z5e	4ddd Z6e	4ddd Z7ddgdd e)D  Z8e9da:e
;d< Z<h dZ=e9dd >e?ej@e= d!ZAd"d# ZBd$eCfd%d&Z3ejDG d'd( d(ZEd8d*d+ZFejDG d,d- d-ZG	 d8d.d/ZHd8d0d1ZIe*D ]ZJe3eJ qeB  d2d3 ZKe	4dd4d5 ZLd6d7 ZMdS )9    N)Optional   )getfile)NestedUserFunctionVariableUserFunctionVariableUserMethodVariable)Z	functorchZ
fx2trt_ossZnetworkxnumpyZ	omegaconfZonnxZonnxruntimeZonnx_tfZpandasZsklearntabulateZ
tensorflowZtensorrtZ	torch2trtZtqdmtreeZtvmZxarrayc                 C   s   t dd| S )Nz__init__.py$ )resub)s r   BC:\wamp64\www\opt\env\Lib\site-packages\torch/_dynamo/skipfiles.py_strip_init_py   s   r   mc                 C   s
   t | jS N)r   __file__)r   r   r   r   _module_dir   s   
r   >   ztorch._constrain_as_sizeztorch._constrain_as_valueztorch._tensor._convert>   z torch.ao.quantization.pt2e.utilsz1torch.ao.quantization.quantizer.xnnpack_quantizerz%torch.ao.quantization.pt2e.eval_utilsz1torch.ao.quantization.pt2e.representation.rewriteztorch.optimztorch._higher_order_ops.condztorch._dynamo.external_utilsztorch._export.wrappersztorch._functorch.apisztorch._functorch.deprecatedztorch._export.db.examplesz$torch.ao.quantization.pt2e.qat_utils>   z%torch.distributed._tensor.device_meshz6torch.distributed.tensor.parallel._data_parallel_utilsztorch.distributed._tensor.apiz;torch.distributed.algorithms._checkpoint.checkpoint_wrapperz'torch.distributed.tensor.parallel.styleztorch.distributed.device_meshz(torch.distributed.tensor.parallel._utils>   ztorch.utils._foreach_utilsztorch._decompztorch._tensorztorch._refsz,torch._dynamo._trace_wrapped_higher_order_opztorch.ao.nnztorch.amp.autocast_modeztorch._dynamo.comptimeztorch.testingztorch.sparseztorch.randomztorch.autograd.functionztorch._primsztorch.utils._contextlibztorch._inductor.test_operatorsztorch.cuda.amp.autocast_modeztorch.fx.passes.shape_propztorch._dynamo.polyfillztorch.distributionsztorch.nnztorch.utils._content_storeztorch.utils._pytreeztorch.fx._pytreeztorch.distributedz)torch.distributed._functional_collectivesc                  C   sD   t  } tD ]}|dd\}}t|}t||}| |j q| S )N.r   )setFUNC_INLINELISTrsplit	importlibimport_modulegetattradd__code__)
inlinelistfmodule_namefn_namer   fnr   r   r   get_func_inlinelist   s   

r$   c                  C   :   t  } tD ]}| tt|tdd  dd  q| S Nztorch.r   /)r   LEGACY_MOD_INLINELISTr   r   torchlenreplacer   r   r   r   r   get_legacy_mod_inlinelist      (r-   c                  C   r%   r&   )r   MOD_INLINELISTr   r   r)   r*   r+   r,   r   r   r   get_mod_inlinelist   r.   r0   z<frozen importlibz<__array_function__ internals>c                 C   s   g | ]}t |qS r   )r   ).0r   r   r   r   
<listcomp>  s    r2   zmatch nothing^ztorch._inductor.config>   ztorchrec/fb/distributedztorchrec/distributedz5caffe2/torch/fb/sparsenn/pooled_embeddings_modules.pyz.*(|)c                   C   s$   t ddtt jt dad S )Nz^(r3   r4   )r   compilejoinmapescape	SKIP_DIRSSKIP_DIRS_REr   r   r   r   _recompile_re  s   $r;   import_namec                 C   sj   t | tjrt| jS t | tsJ ddlm} || }|s d S |j}|d u r)d S t	
t| t  d S )Nr   )	find_spec)
isinstancetypes
ModuleTyper   __name__strimportlib.utilr=   originr9   appendr   r;   )r<   r=   Zmodule_specrD   r   r   r   r     s   

r   c                   @   s"   e Zd ZU eed< ee ed< dS )
SkipResultskippedreasonN)rA   
__module____qualname__bool__annotations__r   rB   r   r   r   r   rF   *  s   
 rF   Fc                    s    du r	t ddS t fddt D rt ddS |r%t r%t ddS tr3tt r3t dd	S tt r?t dd
S t ddS )zShould skip this file?NTzfilename is Nonec                 3       | ]}  |V  qd S r   
startswithr1   dfilenamer   r   	<genexpr>4      zcheck_file.<locals>.<genexpr>Fz1inlined according skipfiles.LEGACY_MOD_INLINELISTz*inlined according skipfiles.MOD_INLINELISTz,skipped according skipfiles.FBCODE_SKIP_DIRSz%skipped according skipfiles.SKIP_DIRSzinlined by default)	rF   anyr-   is_torch_inline_allowed	is_fbcoderK   FBCODE_SKIP_DIRS_REmatchr:   )rS   is_inlined_callr   rR   r   
check_file0  s(   


r\   c                   @   s<   e Zd ZU ee ed< ee ed< eed< eej ed< dS )FunctionInfopy_objnamerS   codeN)	rA   rI   rJ   r   objectrL   rB   r?   CodeTyper   r   r   r   r]   I  s
   
 r]   c                 C   s   t | tttfr(z|  }W n ty   d }Y nw t||  |  | 	 }n.t | t
jr8td | j| j| }nt | t
jt
jfrMt| | jt| | j}n	t| d t| d }|jt v ratddS |rw|jdkrmtddS |jdkrwtddS t|j|S )NFz+inlined according skipfiles.FUNC_INLINELISTZpatched_initTzpatched init cannot be inlined.Z__torch_function__z!allow inlining __torch_function__)r>   r   r   r   Zget_functionNotImplementedErrorr]   get_nameget_filenameget_coder?   rb   co_nameco_filenameFunctionType
MethodTyperA   r   r   r`   r$   rF   r_   r\   rS   )objr[   r^   fir   r   r   check_verboses  s6   




rm   c                 C   s   t | |jS r   )rm   rG   )rk   r[   r   r   r   check  s   rn   c                    s   t  fddt D S )Nc                 3   rM   r   rN   rP   rR   r   r   rT     rU   z*is_torch_inline_allowed.<locals>.<genexpr>)rV   r0   rR   r   rR   r   rW     s   rW   c                  C   s   dd l } t| jS )Nr   )Ztorch._dynamor   Z_dynamo)r)   r   r   r   
dynamo_dir  s   
ro   c                 C   s   |  t rdS |  ttS )NF)rO   ro   r   r)   rR   r   r   r   is_torch  s   rp   )F)N_collections_abc_weakrefsetabccollections
contextlibcopycopyregdataclassesenum	functoolsr   inspect	linecacheloggingmultiprocessingoperatoros	posixpathrandomr   	selectorssignaltempfile	threadingtokenize	tracebackr?   typingZunittestweakrefr   r)   Ztorch._inductor.test_operatorsZtorch.distributedZtorch.utils._content_storeutilsr   Zvariables.functionsr   r   r   ZBUILTIN_SKIPLISTZTHIRDPARTY_SKIPLISTr   r@   r   r   r(   distributedZis_availabler/   r   	lru_cacher$   r-   r0   r9   r5   r:   r   rX   ZFBCODE_SKIP_DIRSr6   r7   r8   rY   r;   rB   	dataclassrF   r\   r]   rm   rn   _namerW   ro   rp   r   r   r   r   <module>   s    ,	
$	





	
 

"
!
