
    i                          % S SK JrJrJrJr  S SKrS SKJs  Js  J	s  J
r  S SKJs  Jr  S SKJrJr  S SKJr  S SKJr  \\R                  R,                  /\\   4   r\\S'    " S S\R2                  5      rg)	    )CallableListOptionalUnionN)ExportErrorExportErrorType)
PassResult)	TypeAliasPassTypec            	          ^  \ rS rSrSr   SS\\\\   \\\      4      S\	S\	SS4U 4S jjjr
S	\R                  R                  SS4S
 jrSrU =r$ )PassManager   aC  
Class to run multiple passes on a given graph module. The PassManager is
callable so to run it, we can just call the PassManager instance.

Private Attributes:
    * **passes**: A list of callable passes
    * **params**: An instance of PassManagerParams containing the result of the
        flags set in the constructor.
Npassesrun_checks_after_each_passsuppress_check_failuresreturnc                    > U(       a  UO/ n[         R                  " U5      S    Vs/ s H  n[        R                  " U5      PM     nn[        TU ]  UUUS9  gs  snf )z
Args:
    passes: A list of passes
    enable_debug_pass: set to true to enable the debug passes
    run_checks_after_each_pass: whether to run checks and linting after each pass
r   )r   r   N)pytreetree_flattenfxpass_result_wrappersuper__init__)selfr   r   r   fnflattened_passes	__class__s         [/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/executorch/exir/pass_manager.pyr   PassManager.__init__    sh     "r171D1DV1LQ1O
1O2B""2&1O 	 
 	'A$; 	 	
	
s    Amodulec                 0   [        U[        R                  5      (       d   eUR                  5         UR                  R                  5         UR                  R                   H1  nUR                  S:X  d  M  [        [        R                  SU S35      e   g)au  
Runs various checks on the given graph module to make sure it contains
the needed data for passes.

Some checks that need to be run:
    - Ensure that types of operator node match the types specified in
      the node's spec field (ex. if the op returns a tuple then the
      node's spec field is a tuple)
    - Ensure that the graph module has type torch.fx.GraphModule
call_methodzcall_method `z/` is not supported except for backend delegate.N)
isinstancer   GraphModule	recompilegraphlintnodesopr   r   NOT_SUPPORTED)r   r    nodes      r   checkPassManager.check9   s|     &"..1111 LL&&Dww-'!#11#D6)XY  '     )NFF)__name__
__module____qualname____firstlineno____doc__r   r   r   r   boolr   torchnnModuler,   __static_attributes____classcell__)r   s   @r   r   r      s     IM+0(-	
tH~tDN/CCDE
 %)
 "&	

 

 
2EHHOO   r.   r   )typingr   r   r   r   r6   "torch.fx.passes.infra.pass_managerr   r   infrapass_managertorch.utils._pytreeutils_pytreer   executorch.exir.errorr   r   torch.fx.passes.infra.pass_baser	   typing_extensionsr
   r$   r   __annotations__r   r/   r.   r   <module>rF      s[    3 2  / / $ $ > 6 ' 4 45x
7KKL) L9".. 9r.   