Ë
    S²j   ã                   ó�  — d Z ddlZddlZddlmZ ddlZddlmZm	Z	 ddl
Z
ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$  ejJ                  e&«      Z'ejP                  d„ «       Z)h d£Z*e
jV                  fd	„Z, e-«       Z.e
jV                  dd
œde/ej`                  ef   dejb                  ez  fd„Z2y)a±  
This is a simple interpreter for Sympy expressions that dispatches to
classes following the torch._inductor.virtualized calling convention.
For directness, the interpreter takes the handler directly rather than
consulting the TLS.  It does not use most of the methods on the full
handler; only those with corresponding Sympy expressions.  To see an example
of a full handler, see torch.utils._sympy.value_ranges.ValueRangeAnalysis.
é    N)ÚAny)ÚBooleanÚBooleanAtomé   )ÚBitwiseFn_bitwise_andÚBitwiseFn_bitwise_orÚBitwiseFn_bitwise_xorÚ	CeilToIntÚCleanDivÚFloatPowÚFloatTrueDivÚFloorDivÚ
FloorToIntÚIdentityÚ
IntTrueDivÚ!IsNonOverlappingAndDenseIndicatorÚMaxÚMinÚModÚModularIndexingÚOpaqueUnaryFn_log2ÚPowByNaturalÚ	PythonModÚRoundDecimalÚ
RoundToIntÚToFloatÚTruncToFloatÚ
TruncToIntÚWherec                  ó6  — i t         j                  d“t         j                  d“t         j                  d“t         j                  d“t         j
                  d“t         j                  d“t         j                  d“t         j                  d“t         j                  d	“t        d
“t        d“t        d“t        d“t        d“t        d“t         j                   d“t         j"                  d“i t$        d“t&        d“t         j(                  d“t*        d“t,        d“t         j*                  d“t         j.                  d“t         j0                  d“t         j2                  d“t         j4                  d“t         j6                  d“t4        d“t6        d“t8        d“t         j:                  j<                  j>                  j@                  d“t         jB                  d“tD        d“¥tF        dtH        dtJ        d tL        d!tN        d"tP        d#i¥} d$D ]  }|| tS        t         |«      <   Œ | S )%NÚor_Úand_ÚeqÚneÚltÚgtÚleÚgeÚnot_Úint_truedivÚtruedivÚfloordivÚtruncÚwhereÚaddÚmulÚpowÚpow_by_naturalÚmodÚ
python_modÚabsÚlogÚexpÚminimumÚmaximumÚmodular_indexingÚexpr_cond_pairÚ	piecewiseÚidentityÚ&is_non_overlapping_and_dense_indicatorÚround_decimalÚlog2Úbitwise_andÚ
bitwise_orÚbitwise_xor)	ÚcosÚsinÚtanÚsinhÚcoshÚtanhÚasinÚacosÚatan)*ÚsympyÚOrÚAndÚEqÚNeÚLtÚGtÚLeÚGeÚNotr   r   r   r   r   r   ÚAddÚMulr   r   ÚPowr   r   ÚAbsr6   r7   r   r   r   Ú	functionsÚ
elementaryr<   ÚExprCondPairÚ	Piecewiser   r   r   r   r   r   r	   Úgetattr)ÚHANDLERSÚnames     úX/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/torch/utils/_sympy/interp.pyÚhandlersrc   7   sn  € ð3Ü�‰�%ð3ä�	‰	�6ð3ô 	�‰�$ð3ô 	�‰�$ð	3ô
 	�‰�$ð3ô 	�‰�$ð3ô 	�‰�$ð3ô 	�‰�$ð3ô 	�	‰	�6ð3ô 	�Mð3ô 	�ið3ô 	�*ð3ô 	�*ð3ô 	�gð3ô 	ˆwð3ô  	�	‰	�5ð!3ô" 	�	‰	�5ñ#3ô$ 	�%ð%3ô& 	Ð&ð'3ô4 	�	‰	Ð#ð53ô6 	ˆUð73ô8 	�<ð93ô@ 	�	‰	�5ðA3ôB 	�	‰	�5ðC3ôD 	�	‰	�5ðE3ôF 	�	‰	�5ðG3ôH 	�	‰	�9ðI3ôJ 	�	‰	�9ðK3ôL 	ˆYðM3ôN 	ˆYðO3ôP 	Ð+ðQ3ôR 	�‰×"Ñ"×,Ñ,×9Ñ9Ð;KðS3ôT 	�‰˜ðU3ôV 	�*ñW3ôX 	*Ð+SÜ�oä˜FÜ˜}Ü˜lÜ˜}ñe3€Hðl Vò .ˆØ)-ˆ”œ Ó%Ò&ð.ð €Oó    >   r/   r0   r!   r"   r9   r8   c                 óè  — t        |t        j                  «      rOt        |j                  d   t        j                  j
                  j                  «      r| j                  |d   «      S t        |t        «      r#| j                  |d   t        j                  «      S t        dt        j                  dt        j                  dt        dt         dt"        di}|j%                  |j&                  «      x}� t)        | |«      g |¢|‘­Ž S |j&                  t        j*                  u rB|j,                  r6t/        | d«      r*| j1                  |«      }t2        j5                  d||«       |S t/        |j&                  d	«      r|j&                  j6                  }nt9        «       |j&                     }t)        | |«      }	 |t:        v rht=        |«      dk  rt?        d
«      ‚ ||d   |d   «      }tA        dt=        |«      «      D ]  }	 ||||	   «      }Œ t2        j5                  d|||«       |S  ||Ž }t2        j5                  d|||«       |S # tB        $ r ‚ tD        $ r t2        jG                  d||«       ‚ w xY w)Nr   r   Útrunc_to_intÚfloor_to_intÚceil_to_intÚround_to_intÚsym_sumzsym_sum(%s) -> %sÚ_torch_handler_namezassociative op needs >1 argsé   z%s(%s) -> %szfailed while executing %s(%s))$Ú
isinstancerM   rY   ÚargsÚcoreÚnumbersÚHalfÚsqrtr   Úto_dtypeÚtorchÚfloat64r   ÚfloorÚceilingr   r
   r   ÚgetÚfuncr_   rW   Ú
is_integerÚhasattrrj   r6   Údebugrk   rc   ÚASSOCIATIVE_OPSÚlenÚAssertionErrorÚrangeÚNotImplementedErrorÚ	ExceptionÚwarning)
Úanalysisrn   ÚexprÚindex_dtypeÚINDEX_DTYPE_HANDLERSÚhandler_nameÚrÚhandlerÚaccÚis
             rb   Ú_run_sympy_handlerr�   }   s  € ä�$œŸ	™	Ô"¤zØ�	‰	�!‰”e—j‘j×(Ñ(×-Ñ-ô(ð �}‰}˜T !™WÓ%Ð%Ü�$œÔ Ø× Ñ   a¡¬%¯-©-Ó8Ð8ô 	�NÜ�‰�^Ü�‰�}Ü�NÜ�=Ü�NðÐð -×0Ñ0°·±Ó;Ð;ˆÐHØ.Œw�x Ó.ÐB°ÐB°kÒBÐBð ‡y�y”E—I‘IÑ $§/¢/´g¸hÈ	Ô6RØ×Ñ˜TÓ"ˆÜ�	‰	Ð% t¨QÔ/Øˆäˆt�y‰yÐ/Ô0Ø—y‘y×4Ñ4‰ä“z $§)¡)Ñ,ˆÜ�h Ó-€GðØœ?Ñ*Ü�4‹y˜AŠ~Ü$Ð%CÓDÐDÙ˜$˜q™' 4¨¡7Ó+ˆCÜ˜1œc $›iÓ(ò ,�Ù˜c 4¨¡7Ó+‘ð,ä�I‰I�n l°D¸#Ô>ØˆJá˜�ˆAÜ�I‰I�n l°D¸!Ô<ØˆHøÜò ØÜò Ü�‰Ð3°\À4ÔHØðús   Æ7A/I È'I É+I1©r†   Úmissing_handlerÚenvr…   c                ó,  — d }t        |t        «      rt        j                  }nUt        |t        j
                  «      rt        j                  }n*t        |t        j                  «      rt        j                  }|�| j                  ||«      S t        |t        j                  «      r5|j                  |t        «      x}t        ur|S |r ||«      S t        |«      ‚t        | |j                  D �cg c]  }t!        | ||||¬«      ‘Œ c}||¬«      S c c}w )NrŽ   )r†   )rm   r   rt   ÚboolrM   ÚIntegerÚint64ÚNumberÚdoubleÚconstantÚSymbolrx   Ú_nilÚKeyErrorr�   rn   Úsympy_interp)r„   r�   r…   r†   r�   Údtyper‰   Úargs           rb   r›   r›   º   s÷   € ð €EÜ�$œÔ$Ü—
‘
‰Ü	�Dœ%Ÿ-™-Ô	(Ü—‘‰Ü	�Dœ%Ÿ,™,Ô	'Ü—‘ˆàÐØ× Ñ   uÓ-Ð-Ü	�Dœ%Ÿ,™,Ô	'Ø—‘˜œtÓ$Ð$ˆA¬TÑ1ØˆHÙÙ" 4Ó(Ð(ä˜4“.Ð ô Øð —y‘yö		
ð ô ØØØØ'Ø /öò		
ð 	Øôð ùò		
s   Ã0D
)3Ú__doc__Ú	functoolsÚloggingÚtypingr   rM   Úsympy.logic.boolalgr   ÚSympyBooleanr   rt   r[   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Ú	getLoggerÚ__name__r6   Úcacherc   r}   r”   r�   Úobjectr™   Údictr˜   ÚExprr›   © rd   rb   ú<module>r«      sÈ   ðñó Û Ý ã ß Dã ÷÷ ÷ ÷ ÷ ÷ õ ð: €g×Ñ˜Ó!€ð ‡�ñ?ó ð?òD F€ð :?¿¹ó 7ñt ƒx€ð —‘Øò*à	ˆe�l‰l˜CÐÑ	 ð*ð �*‰*�|Ñ
#ô*rd   