
    eЄi              	      d   d dl mZ d dlZd dlZd dlmZmZmZ d dlm	Z	 d dl
mZmZmZmZmZ d dlmZmZmZ erd dlmZmZ  edeeeeez  eez        Z edeeedz  ee      Z ed	eeef   ee         Zej<                  	 	 	 	 dd
       ZddZ ddZ!ddZ"	 	 	 	 ddZ#	 	 	 	 ddZ$	 	 	 	 ddZ%y)    )annotationsN)AnyTYPE_CHECKINGTypeVar)BackendIndexDispatchKeyNativeFunctionNativeFunctionsGroupNativeFunctionsViewGroup)contextST)CallableIteratorFF2F3c              #  T  K   t        | t              r| j                  nt        | t              r| j                  n| t        fd      5  t        j                  j                  j                        5  d  d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY ww)Nc                 <    d j                    d j                   S )Nzin native_functions.yaml line z:
  )locfunc)fs   Z/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/torchgen/context.py<lambda>z)native_function_manager.<locals>.<lambda><   s    9!%%affXN     )!use_const_ref_for_mutable_tensorsuse_ilistref_for_tensor_lists)

isinstancer
   outr   viewr   localparametrizer   part_of_structured_group)gr   s    @r   native_function_managerr%   -   s      !)*
 EE	A/	0FF	N	O ./.Q.Q*+*D*D
 	 		 	 	 s6   AB(,B:B?B	B(B	BB%!B(c                D     t        j                         d fd       }|S )Nc                V    t        |       5   |       cd d d        S # 1 sw Y   y xY wNr%   )r   r   s    r   wrapperz%with_native_function.<locals>.wrapperJ   s'    $Q' 	7	 	 	s   ()r   r   returnr   	functoolswrapsr   r*   s   ` r   with_native_functionr0   I   s%    __T  Nr   c                D     t        j                         d fd       }|S )Nc                X    t        |       5   | |      cd d d        S # 1 sw Y   y xY wr(   r)   )r   f2r   s     r   r*   z)with_native_function_and.<locals>.wrapperS   s+     %Q' 	2;	 	 	   	 ))r   r   r3   r   r+   r   r,   r/   s   ` r   with_native_function_andr5   R   s%    __T 
 Nr   c                D     t        j                         d fd       }|S )Nc                X    t        |      5   | |      cd d d        S # 1 sw Y   y xY wr(   r)   slfr   r   s     r   r*   z,method_with_native_function.<locals>.wrapper]   s)    $Q' 	 Q<	  	  	 r4   )r9   r   r   r   r+   r   r,   r/   s   ` r   method_with_native_functionr:   \   s%    __T    Nr   c                D     t        j                         d fd       }|S )Nc                ^    t        |d         5   | |      cd d d        S # 1 sw Y   y xY w)Nr   r)   r8   s     r   r*   z3method_with_nested_native_function.<locals>.wrapperh   s-    $QqT* 	 Q<	  	  	 s   	#,)r9   r   r   r   r+   r   r,   r/   s   ` r   "method_with_nested_native_functionr=   e   s'     __T    Nr   c                D     t        j                         d fd       }|S )Nc                X    t        |       5   | |      cd d d        S # 1 sw Y   y xY wr(   r)   )r   backend_indexr   s     r   r*   z/with_native_function_and_index.<locals>.wrapperu   s*    $Q' 	*=)	* 	* 	*r4   )r   r   r@   r   r+   r   r,   r/   s   ` r   with_native_function_and_indexrA   r   s'     __T* * Nr   c                D     t        j                         d fd       }|S )Nc                X    t        |       5   | |      cd d d        S # 1 sw Y   y xY wr(   r)   )r   backend_indicesr   s     r   r*   z1with_native_function_and_indices.<locals>.wrapper   s*    $Q' 	,?+	, 	, 	,r4   )r   r   rD   zdict[DispatchKey, BackendIndex]r+   r   r,   r/   s   ` r    with_native_function_and_indicesrE   ~   s'     __T, , Nr   )r$   z@NativeFunctionsGroup | NativeFunctionsViewGroup | NativeFunctionr+   zIterator[None])r   Callable[[F], T]r+   rF   )r   Callable[[F, F2], T]r+   rG   )r   Callable[[S, F], T]r+   rH   )r   Callable[[S, F3], T]r+   rI   )r   Callable[[F, BackendIndex], T]r+   rJ   )r   1Callable[[F, dict[DispatchKey, BackendIndex]], T]r+   rK   )&
__future__r   
contextlibr-   typingr   r   r   torchgen.localr!   torchgen.modelr   r   r	   r
   r   torchgen.utilsr   r   r   collections.abcr   r   r   boolstrr   tuplelistr   contextmanagerr%   r0   r5   r:   r=   rA   rE    r   r   <module>rY      s   "   . .   ) ( 2
 ))-- T T5,-tN/CD G 6

(#
;6r   