
    IЦi
                    8   % S r SSKJr  SSKJrJrJrJr  SSKJ	s  J
r  SSKJr  \(       a  SSKJr  / rS\S	'   \R$                  (       a  SSKrSSKrSSKJ	s  Jr  \" \R.                  R0                  S
S9SS j5       rSrS H$  r\" \\5      r\" \S
S9" \R:                  5        CM&     C\" \R<                  S
S9 S     SS jj5       r\" \R>                  SS9 S     SS jj5       r\S/-  r\" \R@                  S
S9 S     SS jj5       r \S/-  rgg)z)
Python polyfills for torch.utils.pytree
    )annotations)AnyCallableIterableTYPE_CHECKINGN   )substitute_in_graph)PyTreez	list[str]__all__T)can_constant_fold_throughc                     [        S5      e)NzeShould not be called directly because the original function will be called in the constant fold path.)
ValueError)argskwargss     ]/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/torch/_dynamo/polyfills/pytree.py_r      s     V
 	
     )is_namedtupleis_namedtuple_classis_namedtuple_instanceis_structseqis_structseq_classis_structseq_instancenamedtuple_fieldsstructseq_fieldsc                ~    U b  Ub  U" U 5      (       a  g[         R                  R                  [        U 5      SS9c  gg)NTtorch)	namespaceF)optreeregister_pytree_nodegettypetreeis_leafs     r   tree_is_leafr'   9   s?    
 <G/GDMM&&**4:*IQr   Fc              #     #    U /nU(       a`  UR                  5       n[        X1S9(       a  Uv   M+  [        R                  " UUSSS9tpEUR	                  [        U5      5        U(       a  M_  g g 7f)Nr&   Tr   )r&   none_is_leafr   )popr'   r    tree_flatten_one_levelextendreversed)r%   r&   stacknodechildrenr   s         r   	tree_iterr2   D   sd     
 99;DD2
!88!!	LH LL(+, es   A(A.,A.r2   c                &    [        [        XS95      $ )Nr)   )listr2   r$   s     r   tree_leavesr5   Z   s    
 Id455r   r5   )r   r   r   r   returnbool)N)r%   r
   r&   Callable[[PyTree], bool] | Noner6   r7   )r%   r
   r&   r8   r6   zIterable[Any])r%   r
   r&   r8   r6   z	list[Any])!__doc__
__future__r   typingr   r   r   r   torch.utils._pytreeutils_pytreepython_pytree
decoratorsr	   torch.utils._cxx_pytreer
   r   __annotations___cxx_pytree_dynamo_traceabler    	optree._C_cxx_pytree
cxx_pytree_Cis_dict_insertion_orderedr   __namegetattr__func__python_implementation__r'   r2   r5    r   r   <module>rN      s   # 9 9 + + , .   --00		++"&
	
 F	 (FdC,,	
 	 	00DQ 480 
 R --O 48--0- 
- P-& }G//4P 486606 
6 Q6 GY .r   