
    Ph                         d Z ddlZddlmZmZ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  ej*                  d      d        Zh dZd	eej0                  ef   d
eej2                  e	f   fdZy)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DictUnion)BooleanBooleanAtom   )CleanDivFloorDiv!IsNonOverlappingAndDenseIndicatorModModularIndexingPowTrueDivWherec                     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         j                  dt         j                  dt         dt         j                   dt"        dt         j"                  dt         j$                  dt         j&                  dt         j(                  dt         j*                  dt         j,                  dt         j.                  dt         j0                  dt2        dt         j4                  j6                  j8                  j:                  dt         j<                  dt>        di} | S )Nor_and_eqneltgtlegenot_truedivfloordivdivwhereaddmulpowmodabslogexpfloorceilminimummaximummodular_indexingexpr_cond_pair	piecewise&is_non_overlapping_and_dense_indicator) sympyOrAndEqNeLtGtLeGeNotr   r
   r	   r   AddMulr   r   Absr$   r%   r&   ceilingMinMaxr   	functions
elementaryr,   ExprCondPair	Piecewiser   )HANDLERSs    dC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/utils/_sympy/interp.pyhandlersrD       s   %		6 	$ 	$	
 	$ 	$ 	$ 	$ 			6 	 	* 	% 	w 			5 			5  	U!" 			5#$ 	U		5		5		5		5Wv		9		9+"",,99;K)+S=H@ O    >   r   r    r   r   r)   r(   envexprc                    d }t        |t              rt        j                  }nUt        |t        j
                        rt        j                  }n*t        |t        j                        rt        j                  }|| j                  ||      S t        |t        j                        r||   S t        |t        j                        rdt        |j                  d   t        j                  j                  j                        r)| j!                  t#        | ||j                  d               S |j                  D cg c]  }t#        | ||       }}t%               |j&                     }t)        | |      }|t*        v rGt-        |      dkD  sJ  ||d   |d         }t/        dt-        |            D ]  }	 ||||	         } |S  || S c c}w )Nr   r      )
isinstancer   torchboolr.   Integerint64NumberdoubleconstantSymbolr   argscorenumbersHalfsqrtsympy_interprD   funcgetattrASSOCIATIVE_OPSlenrange)
analysisrF   rG   dtypeargrS   handler_namehandleraccis
             rC   rX   rX   M   sv    E$$

	D%--	(	D%,,	'  u--	D%,,	'4y $		"z		!ejj((--( }}\(C1FGG 9=		B	L3,	DB:dii(Lh-G&4y1}}d1gtAw'q#d)$A#tAw'C %
~ Cs   8G)__doc__	functoolstypingr   r   r   r.   sympy.logic.boolalgr   SympyBooleanr   rK   r>   r	   r
   r   r   r   r   r   r   	lru_cacherD   r[   rR   ExprrX    rE   rC   <module>rm      s     # #  D 	 	 	 T& &R F"c)*"27

L8P2Q"rE   