+
    &jQ                        ^ RI t ^ RIt^ RIHtHtHt ^ RIHt ^ RI	H
t
 ^ RIHt ^ RIt^ RIt^ RIt^ RIt^ RIHu Ht ^ RIHt . ROt]P.                  P0                  t]P.                  P4                  t]P.                  P8                  tRt]! R4      t]
! R	4      t ]
! R
4      t!R R lt"]R R l4       t#R R lt$R R lt% ! R R4      t&R R lt'R R lt(]R R l4       t)R# )    N)Callable	GeneratorIterator)contextmanager)TypeVar)	ParamSpec)DispatchKeyF_P_T_Rc                b    V ^8  d   QhR\         \        P                  P                  ,          /#    return)r   torch_ops
OpOverload)formats   "n/Users/jameslopez/projects/CWCArchive/cwc-podcast/.venv/lib/python3.14/site-packages/torch/_dispatch/python.py__annotate__r      s"     0 0%***?*?!@ 0    c               #     "   \         P                   FG  p \        \         P                  V 4      pV F$  p\        W4      pV F  p\        W44      x  K  	  K&  	  KI  	  R# 5i)a  
Warning: the set of overloads this will report is very subtle.  It is precisely
the set of torch.ops functions that have actually been accessed from Python
(e.g., we actually called torch.ops.aten.blah at some point.  This is DIFFERENT
from the set of registered operators, which will in general be a larger set,
as this would include all operators which we ran C++ static initializers or
Python operator registration on.  This does not eagerly populate the list on
torch.ops.aten; this list is lazy!

In other words, this is good for traversing over everything that has an
OpOverload object allocated in Python.  We use it for cache invalidation, but
don't rely on this list being complete.

Note that even if we did report all C++ registered overloads, this isn't guaranteed
to be complete either, as a subsequent lazy load of a library which triggers more
registrations could add more things to the set.
N)r   opsgetattr)nspacketsop_namepacketoverloads        r   all_py_loaded_overloadsr       sN     $ ii%))R(GW.F"f// #  s   AA c                2    V ^8  d   QhR\         R,          /# r   r   )NNNr   )r   s   "r   r   r   8   s     @ @9-=#> @r   c               #     "   \         P                  P                  \         P                  P                  P                  4      p \         P                  P                  4       pV '       d   \         P                  ! 4         R x  V '       d   \         P                  ! VR7       R # R #   T '       d   \         P                  ! TR7       i i ; i5i)N)reapply_views)r   _C&_dispatch_tls_is_dispatch_key_includedr	   Functionalize$_functionalization_reapply_views_tls_disable_functionalization_enable_functionalization)f_tlsf_rvs     r   suspend_functionalizationr.   7   s     HH;;**E 8888:D((*@++$? 5++$? s   A=C B' #C'"C		Cc                    V ^8  d   QhR\         P                  R\         P                  R\        . \        3,          RR/# )r   nvrvdescr   N)r   Tensorr   str)r   s   "r   r   r   F   s=     
 

,,
.6r3w.?
	
r   c           
      X   \        V4      '       g   \        R \        V4       24      hV P                  4       VP                  4       8w  d5   \        V! 4        RV P                  4        RVP                  4        24      hV P                  VP                  8w  d-   \        V! 4        RV P                   RVP                   24      h\
        P                  P                  WRR7      w  r4V'       g9   \        V! 4        RV P                  4        RVP                  4        RV R24      hR	# )
desc must be callable, got z: sizes  != z: dtype F)	only_cudaz
: strides z (mismatch at index )N)	callableAssertionErrortypesizedtyper   _prims_commoncheck_significant_stridesstride)r0   r1   r2   same_stridesidxs   &&&  r   check_tensor_metadata_matchesrD   F   s    D>>:4:,GHH	wwyBGGIxx	{$rwwykJKK	xx288xxzbhhZHII++EE
% F L vhjT"))+>RSVRWWXY
 	
 r   c                Z    V ^8  d   QhR\         R\         R\        . \        3,          RR/# )r   nrr2   r   N)objectr   r4   )r   s   "r   r   r   X   s7     N Nf N NxC7H NT Nr   c                   aa	 \        S4      '       g   \        R \        S4       24      h\        P                  ! V 4      w  r4\        P                  ! V4      w  rV\        V4      \        V4      8w  d#   \        \        V4       R\        V4       24      h\        \        \        V4      4      W54       F9  w  o	rx\        V\        P                  4      '       g   K(  \        WxVV	3R l4       K;  	  R# )r6   r7   c                     < S ! 4        R S 2# )z output  )r2   is   r   <lambda>(check_metadata_matches.<locals>.<lambda>d   s    6Lr   N)r:   r;   r<   pytreetree_flattenlenziprange
isinstancer   r3   rD   )
rF   rG   r2   n_vals_n_specr_vals_r_specr0   r1   rL   s
   &&f      @r   check_metadata_matchesrY   X   s    D>>:4:,GHH))!,OF))!,OF 6{c&k!F}DV>??s6{+V<	2"ell++%b.LM =r   c                   D   a  ] tR t^gt o V 3R lR ltV 3R lR ltRtV tR# )Litc                $   < V ^8  d   QhRS[ RR/# )r   sr   Nr4   )r   __classdict__s   "r   r   Lit.__annotate__h   s      # $ r   c                    Wn         R # Nr]   )selfr]   s   &&r   __init__Lit.__init__h   s    r   c                    < V ^8  d   QhRS[ /# r   r^   )r   r_   s   "r   r   r`   k   s      # r   c                    V P                   # rb   rc   )rd   s   &r   __repr__Lit.__repr__k   s    vvr   rc   N)__name__
__module____qualname____firstlineno__re   ri   __static_attributes____classdictcell__)r_   s   @r   r[   r[   g   s       r   r[   c                0    V ^8  d   QhR\         R\         /# )r   ar   )rH   )r   s   "r   r   r   o   s      F v r   c           	          \        V \        P                  4      '       dE   \        R \	        V P                  4       4       RV P                  4        RV P                   R24      # V # )ztorch.empty_strided(, z, dtype=r9   )rT   r   r3   r[   tupler=   rA   r>   )rr   s   &r   _fmtrv   o   sU    !U\\"""5?"32ahhj\!''RST
 	
 r   c                    V ^8  d   QhR\         P                  P                  \        \        3,          R\
        R\        \        \        3,          \
        ,          /# )r   op	final_keyr   )r   r   r   r
   r   r	   r   )r   s   "r   r   r   x   sJ     C C

b"f%C2=Cb"f#Cr   c                    a aa ^ RI Ho S \        P                  P                  P
                  P                  J d   S# R VVV 3R llpV# )r   )FakeTensorModec                d    V ^8  d   QhR\         P                  R\         P                  R\        /# )r   argskwargsr   )r
   r}   r~   r   )r   s   "r   r   1make_crossref_functionalize.<locals>.__annotate__   s)     8 8rww 8")) 8 8r   c                  N  <a	a
a S! 4       o	R  V	3R llpR R lp\         P                  P                  P                  4       ;_uu_ 4        \	        4       ;_uu_ 4        \
        P                  ! W V34      w  rE\
        P                  ! W4V34      w  o
oS	;_uu_ 4        S! V/ VB pRRR4       RRR4       RRR4       SP                  ! S.V O5/ VB pR VV
V3R llp\        XWx4       V#   + '       g   i     LO; i  + '       g   i     LZ; i  + '       g   i     Le; i)c                    V ^8  d   QhR\         R\         \        P                  P                  P                  ,          /# r   tr   )r   r   _subclassesfake_tensor
FakeTensor)r   s   "r   r   Bmake_crossref_functionalize.<locals>.handler.<locals>.__annotate__   s1     	 	R 	B):):)F)F)Q)Q$Q 	r   c                   < \        V \        P                  4      '       d   \        P                  ! V 4      '       d   \        P                  ! V 4      pV P                  4       VP                  4       8w  d.   \        R V P                  4        RVP                  4        24      hV P                  4       VP                  4       8w  d.   \        RV P                  4        RVP                  4        24      hMT pSP                  V4      # V # )zsize mismatch: r7   zstride mismatch: )	rT   r   r3   _is_functional_tensor_from_functional_tensorr=   r;   rA   from_tensor)r   rG   	fake_modes   & r   fakeify_defunCmake_crossref_functionalize.<locals>.handler.<locals>.fakeify_defun   s    !U\\**..q1155a8A
 vvx1668+,qvvxjQVVXJ-WXXxxzQXXZ/,/
|4
|L  0
 A ,,Q//Hr   c                Z    V ^8  d   QhR\         R\         \        P                  ,          /# r   )r   r   r3   )r   s   "r   r   r      s#     	 	B 	2#4 	r   c                 f    \        V \        P                  4      '       d   V P                  4       # V # rb   )rT   r   r3   detach)r   s   &r   maybe_detachBmake_crossref_functionalize.<locals>.handler.<locals>.maybe_detach   s$    !U\\**xxz!r   Nc                $    V ^8  d   QhR\         /# r   r^   )r   s   "r   r   r      s     
	' 
	'c 
	'r   c                     < R P                  \        P                  ! R S 4       R SP                  4        4       4      4      p S RV  R2# )rt   c              3   j   "   T F)  p\        \        P                  ! \        V4      4      x  K+  	  R # 5irb   )reprrO   tree_maprv   ).0rr   s   & r   	<genexpr>Mmake_crossref_functionalize.<locals>.handler.<locals>.desc.<locals>.<genexpr>   s#     I[T&//$233[s   13c              3   f   "   T F'  w  rV R \         P                  ! \        V4       2x  K)  	  R# 5i)=N)rO   r   rv   )r   kvs   &  r   r   r      s0      $9DA #QvtQ789$9s   /1(r9   )join	itertoolschainitems)fmt_argsrx   orig_f_argsorig_f_kwargss    r   r2   :make_crossref_functionalize.<locals>.handler.<locals>.desc   sP    yyI[I$1$7$7$9H T8*A&&r   )	r   utils_python_dispatch_disable_current_modesr.   rO   r   _op_dkrY   )r}   r~   r   r   f_argsf_kwargsf_rrG   r2   r   r   r   r{   ry   rx   s   *,       @@@r   handler,make_crossref_functionalize.<locals>.handler   s    "$		 	(	 KK((??AA%''%}VnMF)/x0*&K &-H-  ( B IIi1$1&1
	' 
	' 	sA,#  (' BAs=   DA D		C.'D	/D.C>9D	DDD$	)torch._subclasses.fake_tensorr{   r   r   aten
lift_freshdefault)rx   ry   r   r{   s   ff @r   make_crossref_functionalizer   x   s>     = 
UYY^^&&...8 8t Nr   c                2    V ^8  d   QhR\         R,          /# r"   r#   )r   s   "r   r   r      s     E Ey1A'B Er   c            	   #     "   \        4        F6  p V P                  \        P                  P                  P
                  4       K8  	   \        4       ;_uu_ 4        \        P                  P                  R R4      ;_uu_ 4        Rx  RRR4       RRR4       \        4        F6  p V P                  \        P                  P                  P
                  4       K8  	  R#   + '       g   i     L^; i  + '       g   i     Li; i  \        4        F6  p T P                  \        P                  P                  P
                  4       K8  	  i ; i5i)z-torch._dispatch.python.CROSSREF_FUNCTIONALIZETN)
r    _uncache_dispatchr   r&   r	   r(   enable_python_dispatcherunittestmockpatch)rx   s    r   enable_crossref_functionalizer      s     %'
UXX11??@ (E$&&MM OQUVV W '
 *+B  !5!5!C!CD ,	 WV '&
 *+B  !5!5!C!CD ,sP   AED )C1C	C1D AEC.)C11D	<D AE

E)r   no_python_dispatcherenable_pre_dispatch)*r   unittest.mockr   collections.abcr   r   r   
contextlibr   typingr   typing_extensionsr   r   torch._C
torch._opstorch.utils._python_dispatchtorch.utils._pytreer   _pytreerO   r	   __all__r&   _DisablePythonDispatcherr   _EnablePythonDispatcherr   _EnablePreDispatchr   CROSSREF_FUNCTIONALIZEr
   r   r   r    r.   rD   rY   r[   rv   r   r   rK   r   r   <module>r      s      9 9 %  '    # $ $   Vxx88  88;; hh11  t_T]T]04 @ @
$N CP E Er   