
    JTh$5                     *   S SK r S SKrS SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJrJrJrJrJrJr   " S S5      r " S S\5      r " S S	\5      rS
\R:                  S\R<                  S\R:                  4S jr " S S5      r g)    N)Union)_keep_floatBitwiseFn_bitwise_andBitwiseFn_bitwise_orFloatPowFloatTrueDivFloorDiv
IntTrueDivMaxMinModOpaqueUnaryFn_expOpaqueUnaryFn_logOpaqueUnaryFn_log2OpaqueUnaryFn_sqrtPowByNaturalRoundDecimal
RoundToIntToFloat
TruncToIntc                      \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       r\	S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\	S 5       r \S 5       r!\S 5       r"\S 5       r#\S  5       r$\S! 5       r%\S" 5       r&\S# 5       r'\S$ 5       r(\S% 5       r)\S& 5       r*\S' 5       r+\S( 5       r,\S) 5       r-\S* 5       r.S+r/g,)-ReferenceAnalysis&   c                 .    [         R                  " U 5      $ N)sympysympifycdtypes     T/var/www/auris/envauris/lib/python3.13/site-packages/torch/utils/_sympy/reference.pyconstantReferenceAnalysis.constant'       }}Q    c                 
    X-  $ r    abs     r!   or_ReferenceAnalysis.or_+   	    ur%   c                 
    X-  $ r   r'   r(   s     r!   and_ReferenceAnalysis.and_/   r-   r%   c                     [        U [        R                  5      (       d  [        U[        R                  5      (       a  [        R                  " X5      $ X:H  $ r   )
isinstancer   ExprEqr(   s     r!   eqReferenceAnalysis.eq3   s8    a$$
1ejj(A(A88A>!vr%   c                 B    U R                  U R                  X5      5      $ r   )not_r5   clsr)   r*   s      r!   neReferenceAnalysis.ne9   s    xxq%%r%   c                 
    X:  $ r   r'   r(   s     r!   ltReferenceAnalysis.lt=   r-   r%   c                 
    X:  $ r   r'   r(   s     r!   gtReferenceAnalysis.gtA   r-   r%   c                 
    X:*  $ r   r'   r(   s     r!   leReferenceAnalysis.leE   	    vr%   c                 
    X:  $ r   r'   r(   s     r!   geReferenceAnalysis.geI   rF   r%   c                 6    [        U [        5      (       a   eU ) $ r   )r2   boolr)   s    r!   r8   ReferenceAnalysis.not_M   s    a&&&&r	r%   c                     [        SU 5      $ )Ng      ?r   xs    r!   
reciprocalReferenceAnalysis.reciprocalR   s    C##r%   c                     [        U S5      $ )N   r   rP   s    r!   squareReferenceAnalysis.squareV   s    Aq!!r%   c                     [        U 5      $ r   )r   rQ   r    s     r!   trunc_to_intReferenceAnalysis.trunc_to_intZ       !}r%   c                 .    [         R                  " U 5      $ r   )r   ceilingrZ   s     r!   ceil_to_intReferenceAnalysis.ceil_to_int^   r$   r%   c                 .    [         R                  " U 5      $ r   )r   floorrZ   s     r!   floor_to_intReferenceAnalysis.floor_to_intb   s    {{1~r%   c                 @    [        [        R                  5      " U 5      $ r   )r   r   rc   rP   s    r!   rc   ReferenceAnalysis.floorf   s    5;;'**r%   c                 @    [        [        R                  5      " U 5      $ r   )r   r   r_   rP   s    r!   ceilReferenceAnalysis.ceilj   s    5==)!,,r%   c                 ^    U[         R                  :X  a  [        U 5      $ [        SU S35      eNz	to_dtype z NYI)torchfloat64r   NotImplementedErrorrZ   s     r!   to_dtypeReferenceAnalysis.to_dtypen   s,    EMM!1:!IeWD"9::r%   c                     [        X5      $ r   )r   rQ   ys     r!   modReferenceAnalysis.modt       1yr%   c                     [        U 5      $ r   )absrP   s    r!   ry   ReferenceAnalysis.absx   s    1vr%   c                     U * $ r   r'   rP   s    r!   negReferenceAnalysis.neg|   s	    r	r%   c                     [        X5      $ r   rO   r(   s     r!   truedivReferenceAnalysis.truediv       A!!r%   c                     [        X5      $ r   )r
   r(   s     r!   int_truedivReferenceAnalysis.int_truediv   s    !r%   c                     [        X5      $ r   )r	   r(   s     r!   floordivReferenceAnalysis.floordiv   s    ~r%   c                     [        S5      e)NzTODO: truncdivro   r(   s     r!   truncdivReferenceAnalysis.truncdiv   s    !"233r%   c                 @    [        [        R                  5      " X5      $ r   )r   operatoraddr(   s     r!   r   ReferenceAnalysis.add       8<<(..r%   c                 (    [         R                  " U6 $ r   )r   Add)r:   argss     r!   sym_sumReferenceAnalysis.sym_sum   s    yy$r%   c                 @    [        [        R                  5      " X5      $ r   )r   r   mulr(   s     r!   r   ReferenceAnalysis.mul   r   r%   c                 @    [        [        R                  5      " X5      $ r   )r   r   subr(   s     r!   r   ReferenceAnalysis.sub   r   r%   c                     [        U 5      $ r   )r   rP   s    r!   expReferenceAnalysis.exp        ##r%   c                     [        U 5      $ r   )r   rP   s    r!   logReferenceAnalysis.log   r   r%   c                     [        U 5      $ r   )r   rP   s    r!   log2ReferenceAnalysis.log2       !!$$r%   c                     [        U 5      $ r   )r   rP   s    r!   sqrtReferenceAnalysis.sqrt   r   r%   c                 ,    [        [        5      " X5      $ r   )r   r   r(   s     r!   powReferenceAnalysis.pow   s    8$Q**r%   c                     [        X5      $ r   rV   r(   s     r!   pow_by_natural ReferenceAnalysis.pow_by_natural   r   r%   c                     [        X5      $ r   )r   r(   s     r!   minimumReferenceAnalysis.minimum   rw   r%   c                     [        X5      $ r   )r   r(   s     r!   maximumReferenceAnalysis.maximum   rw   r%   c                     [        U 5      $ r   )r   r)   r    s     r!   round_to_intReferenceAnalysis.round_to_int   r]   r%   c                     [        X5      $ r   )r   r(   s     r!   round_decimalReferenceAnalysis.round_decimal   r   r%   c                     [        X5      $ r   )r   r(   s     r!   bitwise_andReferenceAnalysis.bitwise_and   s    $Q**r%   c                     [        X5      $ r   )r   r(   s     r!   
bitwise_orReferenceAnalysis.bitwise_or   s    #A))r%   r'   N)0__name__
__module____qualname____firstlineno__staticmethodr"   r+   r/   r5   classmethodr;   r>   rA   rD   rH   r8   rR   rW   r[   r`   rd   rc   ri   rp   ru   ry   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r'   r%   r!   r   r   &   s4            
 & &           $ $ " "         + + - - ; ;
       " "       4 4 / /     / / / / $ $ $ $ % % % % + + " "       " " + + * *r%   r   c                      \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       rSrg)PythonReferenceAnalysis   c                     U[         R                  L a  [        U 5      $ U[         R                  L a  [	        U 5      $ U[         R
                  L a  [        U 5      $ [        SU 35      e)Nunrecognized dtype )rm   int64intdoublefloatrK   AssertionErrorr   s     r!   r"    PythonReferenceAnalysis.constant   sT    EKKq6Mell"8Oejj 7N #6ug!>??r%   c                 .    [         R                  " U 5      $ r   )rm   sym_notrL   s    r!   r8   PythonReferenceAnalysis.not_   r$   r%   c                     [        U5      S:X  a  g[        U5      S:X  a  US   $ U R                  US   US   5      n[        S[        U5      5       H  nU R                  X!U   5      nM     U$ )Nr      rU   )lenr   range)r:   r   accis       r!   r   PythonReferenceAnalysis.sym_sum   sh    t9>t9>7Nggd1gtAw'q#d)$A''#Aw'C %
r%   c                 
    X-  $ r   r'   r(   s     r!   r    PythonReferenceAnalysis.floordiv   rF   r%   c                 
    X-  $ r   r'   rs   s     r!   ru   PythonReferenceAnalysis.mod   r-   r%   c                 
    X-  $ r   r'   r(   s     r!   r    PythonReferenceAnalysis.truncdiv   r-   r%   c                 t    U[         R                  :X  a  [         R                  " U 5      $ [        SU S35      erl   )rm   rn   	sym_floatro   rZ   s     r!   rp    PythonReferenceAnalysis.to_dtype   s1    EMM!??1%%!IeWD"9::r%   c                     [        S5      e)Nz!exp is not valid shape sympy exprr   rP   s    r!   r   PythonReferenceAnalysis.exp      @AAr%   c                     [        S5      e)Nz!log is not valid shape sympy exprr   rP   s    r!   r   PythonReferenceAnalysis.log  r   r%   c                 .    [         R                  " U 5      $ r   )rm   	_sym_log2rP   s    r!   r   PythonReferenceAnalysis.log2	      q!!r%   c                 .    [         R                  " U 5      $ r   )rm   	_sym_sqrtrP   s    r!   r   PythonReferenceAnalysis.sqrt  r   r%   c                 .    [         R                  " X5      $ r   )rm   sym_minr(   s     r!   r   PythonReferenceAnalysis.minimum      }}Q""r%   c                 .    [         R                  " X5      $ r   )rm   sym_maxr(   s     r!   r   PythonReferenceAnalysis.maximum  r   r%   c                 .    [         R                  " U 5      $ r   )mathrc   rZ   s     r!   rd   $PythonReferenceAnalysis.floor_to_int  s    zz!}r%   c                 .    [         R                  " U 5      $ r   )r   ri   rZ   s     r!   r`   #PythonReferenceAnalysis.ceil_to_int  s    yy|r%   c                 @    [        [        R                  " U 5      5      $ r   )r   r   rc   rP   s    r!   rc   PythonReferenceAnalysis.floor!  s    TZZ]##r%   c                 @    [        [        R                  " U 5      5      $ r   )r   r   ri   rP   s    r!   ri   PythonReferenceAnalysis.ceil%  s    TYYq\""r%   c                 
    X-  $ r   r'   r(   s     r!   r   PythonReferenceAnalysis.truediv)  r-   r%   c                 
    X-  $ r   r'   r(   s     r!   r   PythonReferenceAnalysis.pow-  s	    tr%   c                 
    X-  $ r   r'   r(   s     r!   r   &PythonReferenceAnalysis.pow_by_natural1  s    
 tr%   c                     [        U 5      $ r   roundr   s     r!   r   $PythonReferenceAnalysis.round_to_int8  s    Qxr%   c                     [        XS9$ )N)ndigitsr  r(   s     r!   r   %PythonReferenceAnalysis.round_decimal<  s    Q""r%   c                 
    X-  $ r   r'   r(   s     r!   r   #PythonReferenceAnalysis.bitwise_and@  r-   r%   c                 
    X-  $ r   r'   r(   s     r!   r   "PythonReferenceAnalysis.bitwise_orD  r-   r%   r'   N)r   r   r   r   r   r"   r8   r   r   r   ru   r   rp   r   r   r   r   r   r   rd   r`   rc   ri   r   r   r   r   r   r   r   r   r'   r%   r!   r   r      s   @ @             ; ;
 B B B B " " " " # # # #     $ $ # #         # #    r%   r   c                   $    \ rS rSr\S 5       rSrg) OptimizedPythonReferenceAnalysisiK  c                 .    [         R                  " U 5      $ r   )rm   r   )r   s    r!   r   (OptimizedPythonReferenceAnalysis.sym_sumL  s    }}T""r%   r'   N)r   r   r   r   r   r   r   r'   r%   r!   r  r  K  s    # #r%   r  rQ   r    returnc                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   opsprimsconvert_element_typedefaultrZ   s     r!   	_to_dtyper   Q  s!    99??//77AAr%   c                   $   \ rS rSr\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r	\S 5       r
\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r \S 5       r!\S 5       r"\S 5       r#\S  5       r$\S! 5       r%\S" 5       r&\S# 5       r'\S$ 5       r(\S% 5       r)\S& 5       r*\S' 5       r+\S( 5       r,\S) 5       r-\S* 5       r.\S+ 5       r/\S, 5       r0\S- 5       r1\S. 5       r2\S/ 5       r3\S0 5       r4\S1 5       r5\S2 5       r6S3r7g4)5TensorReferenceAnalysisic  c                 :   U[         R                  L a  [        U 5      nOLU[         R                  L a  [	        U 5      nO-U[         R
                  L a  [        U 5      nO[        SU 35      e[         R                  R                  R                  R                  X!S9$ )Nr   )r    )rm   r   r   r   r   rK   r   r  atenscalar_tensorr  )r   r    ds      r!   r"    TensorReferenceAnalysis.constantf  sx     EKKAAell"aAejj QA #6ug!>??yy~~++33A3CCr%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  
logical_orr  r(   s     r!   r+   TensorReferenceAnalysis.or_s  s!    yy~~((0066r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  logical_andr  r(   s     r!   r/   TensorReferenceAnalysis.and_w  s!    yy~~))11!77r%   c                 T    [         R                  R                  R                  X5      $ r   )rm   r  r$  r   r(   s     r!   r   #TensorReferenceAnalysis.bitwise_and{  s    yy~~))!//r%   c                 T    [         R                  R                  R                  X5      $ r   )rm   r  r$  r   r(   s     r!   r   "TensorReferenceAnalysis.bitwise_or  s    yy~~((..r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r5   Tensorr(   s     r!   r5   TensorReferenceAnalysis.eq  !    yy~~  ''--r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r;   r3  r9   s      r!   r;   TensorReferenceAnalysis.ne  r5  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r>   r3  r(   s     r!   r>   TensorReferenceAnalysis.lt  r5  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  rA   r3  r(   s     r!   rA   TensorReferenceAnalysis.gt  r5  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  rD   r3  r(   s     r!   rD   TensorReferenceAnalysis.le  r5  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  rH   r3  r(   s     r!   rH   TensorReferenceAnalysis.ge  r5  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  logical_notr  rL   s    r!   r8   TensorReferenceAnalysis.not_  s!    yy~~))11!44r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  rR   r  rP   s    r!   rR   "TensorReferenceAnalysis.reciprocal  s!    yy~~((0033r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  rW   r  rP   s    r!   rW   TensorReferenceAnalysis.square  s#     yy~~$$,,Q//r%   c                 |    [        [        R                  R                  R                  R                  U 5      U5      $ r   )r   rm   r  r$  truncr  rZ   s     r!   r[   $TensorReferenceAnalysis.trunc_to_int  (    --55a8%@@r%   c                 |    [        [        R                  R                  R                  R                  U 5      U5      $ r   )r   rm   r  r$  ri   r  rZ   s     r!   r`   #TensorReferenceAnalysis.ceil_to_int  s(    ,,44Q7??r%   c                 |    [        [        R                  R                  R                  R                  U 5      U5      $ r   )r   rm   r  r$  rc   r  rZ   s     r!   rd   $TensorReferenceAnalysis.floor_to_int  rJ  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  rc   r  rP   s    r!   rc   TensorReferenceAnalysis.floor  !    yy~~##++A..r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  ri   r  rP   s    r!   ri   TensorReferenceAnalysis.ceil  !    yy~~""**1--r%   c                     [        X5      $ r   )r   rZ   s     r!   rp    TensorReferenceAnalysis.to_dtype  s    ""r%   c                     [        S5      e)Nz8no C-style modulus operation available from frontend atmr   rs   s     r!   ru   TensorReferenceAnalysis.mod  s     "F
 	
r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  ry   r  rP   s    r!   ry   TensorReferenceAnalysis.abs  !    yy~~!!))!,,r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r|   r  rP   s    r!   r|   TensorReferenceAnalysis.neg  r[  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  true_divider3  r(   s     r!   r   TensorReferenceAnalysis.truediv  s!    yy~~))0066r%   c                     [        S5      e)Nz8Python int truediv difficult to implement in PyTorch atm)ro   rm   r  r$  r_  r  r   rn   r(   s     r!   r   #TensorReferenceAnalysis.int_truediv      !F
 	
r%   c                 f    [         R                  R                  R                  R	                  XSS9$ )Nrc   )rounding_mode)rm   r  r$  divTensor_moder(   s     r!   r    TensorReferenceAnalysis.floordiv  s&    yy~~!!--a'-JJr%   c                     [        S5      e)Nz9no C-style truncdiv operation available from frontend atmr   r(   s     r!   r    TensorReferenceAnalysis.truncdiv  s    !G
 	
r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r   r3  r(   s     r!   r   TensorReferenceAnalysis.add  !    yy~~!!((..r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r   r3  r(   s     r!   r   TensorReferenceAnalysis.mul  rm  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r   r3  r(   s     r!   r   TensorReferenceAnalysis.sub  rm  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r   r  rP   s    r!   r   TensorReferenceAnalysis.exp  r[  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r   r  rP   s    r!   r   TensorReferenceAnalysis.log  r[  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r   r  rP   s    r!   r   TensorReferenceAnalysis.log2  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r   r  rP   s    r!   r   TensorReferenceAnalysis.sqrt  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  sinr  rP   s    r!   r{  TensorReferenceAnalysis.sin  r[  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  cosr  rP   s    r!   r~  TensorReferenceAnalysis.cos
  r[  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  tanhr  rP   s    r!   r  TensorReferenceAnalysis.tanh  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  sinhr  rP   s    r!   r  TensorReferenceAnalysis.sinh  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  coshr  rP   s    r!   r  TensorReferenceAnalysis.cosh  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  tanr  rP   s    r!   r  TensorReferenceAnalysis.tan  r[  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  acosr  rP   s    r!   r  TensorReferenceAnalysis.acos  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  atanr  rP   s    r!   r  TensorReferenceAnalysis.atan"  rT  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  asinr  rP   s    r!   r  TensorReferenceAnalysis.asin&  rT  r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   rm   r  r$  r   Tensor_Tensorr(   s     r!   r   TensorReferenceAnalysis.pow*  s!    yy~~!!//55r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   r  r(   s     r!   r   &TensorReferenceAnalysis.pow_by_natural.  s#     yy~~!!//55r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r   r  r(   s     r!   r   TensorReferenceAnalysis.minimum3  !    yy~~%%--a33r%   c                 h    [         R                  R                  R                  R	                  X5      $ r   )rm   r  r$  r   r  r(   s     r!   r   TensorReferenceAnalysis.maximum7  r  r%   c                 h    [         R                  R                  R                  R	                  U 5      $ r   )rm   r  r$  r  r  r   s     r!   r   $TensorReferenceAnalysis.round_to_int;  rQ  r%   c                     [        S5      e)Nz8round decimal doesn't support Tensor second argument atmr   r(   s     r!   r   %TensorReferenceAnalysis.round_decimal?  rc  r%   r'   N)8r   r   r   r   r   r"   r+   r/   r   r   r5   r   r;   r>   rA   rD   rH   r8   rR   rW   r[   r`   rd   rc   ri   rp   ru   ry   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   r   r   r'   r%   r!   r"  r"  c  s    
D 
D 7 7 8 8 0 0 / / . . . . . . . . . . . . 5 5 4 4 0 0 A A @ @ A A / / . . # # 
 
 - - - - 7 7 

 

 K K 
 

 / / / / / / - - - - . . . . - - - - . . . . . . - - . . . . . . 6 6 6 6 4 4 4 4 / / 
 
r%   r"  )!r   r   typingr   r   rm   torch.utils._sympy.functionsr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r3  r    r   r"  r'   r%   r!   <module>r     s             :h* h*\r/ rn#'> #B Bekk Bell B$`
 `
r%   