
    9i                    \   S SK Jr  S SKrS SKJr  S SKJrJrJrJ	r	  S SK
Jr  \(       a  S SKJr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKJr  \" S5      r\	" S	5      r\R4                  SS
 j5       r\R4                  SS j5       r " S S\R:                  R<                  5      rg)    )annotationsN)nullcontext)AnyCallableTYPE_CHECKINGTypeVar)	ParamSpec)Sequence)torch_function_passthrough_P_Rc            	     (   [         [         R                  4[         R                  [         R                  R                  4[         R                  R                  [         R                  R                  R                  4[         R                  [         R                  R                  4[         R
                  [         R                  R
                  4[         R                  [         R                  R                  4/n 0 [         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                  R0                  [         R                  R2                  _[         R                  R4                  [         R                  R6                  _[         R                  R8                  [         R                  R:                  _[         R                  R<                  [         R                  R<                  _[         R                  R>                  [         R                  R>                  _[         R                  R@                  [         R                  R@                  _[         R                  RB                  [         R                  RB                  _[         R                  RD                  [         R                  RD                  _[         R                  RF                  [         R                  RF                  _[         R                  RH                  [         R                  RH                  [         R                  RJ                  [         R                  RJ                  [         R                  RL                  [         RN                  RP                  [         R                  RR                  [         RN                  RR                  0EnU  HN  u  p#URT                   H9  nURV                  RY                  U5      XRV                  RY                  U5      '   M;     MP     [[        [         R                  5       Hg  nU[         R                  RT                  ;   d  M#  [         R                  RV                  RY                  U5      U[]        [         R                  U5      '   Mi     [         R                  R^                  RT                   Hj  n[]        [         R                  US5      =(       d    []        [         U5      n[         R                  R^                  RV                  RY                  U5      X'   Ml     U$ )zq
Mapping of torch API functions to torch._refs functions.
E.g. torch_to_refs_map()[torch.add] == torch._refs.add
N)0torch_refsnn
functionalspecialfftlinalgTensor
__invert__bitwise_not__xor__bitwise_xor__and__bitwise_and__or__
bitwise_or__eq__eq__rsub__rsub__rtruediv__rtruediv__floordiv__floor_divide__rfloordiv__	rfloordiv__pow__pow__rpow__rpow	new_emptynew_full	new_zerosnew_onesfill_zero_tosum_to_sizecopy__primscopy_toresize__all____dict__getdirgetattr_conversions)modulesr	mod_torchmod_refsstensor_attrs         T/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/torch/_prims/context.pytorch_to_refs_maprF      s    
	5;;>>"			ekknn778	++,	EKKOO$	u{{))*G!8!8ekk55 	ekk55 	U[[33	
 	U[[^^ 	u{{// 	!!5;;#7#7 	!!5;;#;#; 	""EKK$9$9 	ekkoo 	u{{// 	 5 5 	u{{33 	 5 5 	u{{33  	EKK--!" 	EKK--#$ 	  %++"9"9ELL00U\\00-A0  '	!!A+3+<+<+@+@+CA  $$Q'( "  '
 ###*/++*>*>*B*B1*EAgellA&' 
 [[%%--ellAt4Iq8I11::>>qA . H    c                     [         R                  R                   V s1 s H,  n [         R                  R                  R	                  U 5      iM.     sn $ s  sn f )zB
Set of all prim functions, e.g., torch._prims.add in all_prims()
)r   r6   r9   r:   r;   )rC   s    rE   	all_primsrI   R   s=    
 38,,2F2FG2FQELL!!%%a(2FGGGs   3Ac                  `    \ rS rSrSrSS \4       S	S jjr  S
         SS jjrSrg)TorchRefsModeZ   a  
Switches the interpretation of torch.* functions and Tensor methods to
use PrimTorch refs in torch._refs.  (Direct calls to _refs are unaffected.)

>>> # xdoctest: +SKIP
>>> with TorchRefsMode():
...     torch.add(x, y)  # calls torch._refs.add(x, y)

By default, this context manager will fall back on the torch.* if the
ref does not exist; set strict=True to error if this occurs.
If the ref exists we still would like to fall back on the torch.* sometimes,
this behavior can be customized by passing a function to should_fallback_fn.
Fc                     g)NF )_s    rE   <lambda>TorchRefsMode.<lambda>l   s    UrG   c                (    Xl         X l        X0l        g )N)strictshould_fallback_fnprims_mode_cls)selfrS   rT   rU   s       rE   __init__TorchRefsMode.__init__i   s     "4,rG   Nc                   Uc  0 nU[         ;   d  U[        5       ;   a"  U R                  5          U" U0 UD6sS S S 5        $ [        5       nUR	                  US 5      nUcT  [        U[        R                  R                  5      (       a+  [        R                  R                  R	                  US 5      nOUc  [        U[        R                  R                  5      (       ag  [        USS 5      nUc*  UR                  (       a  [        XR                  S   S 5      nUb*  [        R                  R                  R	                  US 5      nUb4  U R                  XXcU5      (       a  U" U0 UD6$ U    U" U0 UD6sS S S 5        $ U R                  (       a+  [!        S[        R"                  R%                  U5       35      eU" U0 UD6$ ! , (       d  f       GN= f! , (       d  f       Nd= f)Ndefaultr   zno _refs support for )r   rI   rU   rF   r;   
isinstancer   _ops
OpOverload_decompdecomposition_tableOpOverloadPacketr=   _dirrT   rS   RuntimeError	overridesresolve_name)rV   	orig_functypesargskwargsmappingfuncrZ   s           rE   __torch_function__ TorchRefsMode.__torch_function__s   s    >F 22i9;6N$$& $1&1 '&#%{{9d+ <Jy%**2G2GHH==4488DID\jEJJ4O4OPPiD9G9>>!)^^A->E"}}88<<WdK&&tFKK $1&11T,V, ;;'(D(DY(O'PQ  $)&))? '&2 s   G+G
G
G!)rU   rT   rS   )rS   boolrT   zCallable[..., bool]rU   typereturnNone)rN   N)
re   zCallable[_P, _R]rf   zSequence[type]rg   zSequence[Any]rh   zdict[str, Any] | Nonero   r   )	__name__
__module____qualname____firstlineno____doc__r   rW   rk   __static_attributes__rN   rG   rE   rK   rK   Z   s      2B*	-- 0- 	-
 
- !(,+*#+* +* 	+*
 &+* 
+* +*rG   rK   )ro   zdict[Any, Any])ro   zset[Any]) 
__future__r   	functools
contextlibr   typingr   r   r   r   typing_extensionsr	   collections.abcr
   r   torch._decomptorch._primstorch._refstorch._refs.nntorch._refs.nn.functionaltorch._refs.specialtorch.overridestorch._prims_commonr   r   r   cacherF   rI   rc   TorchFunctionModerK   rN   rG   rE   <module>r      s    "  " 8 8 ' (          : t_T] 3 3l H HD*EOO55 D*rG   