
    Og              
      t   d dl mZ d dlZd dlZd dlmZmZmZ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  e	deeee
eef   e
eef         Z e	deeee   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CallableOptionalTYPE_CHECKINGTypeVarUnion)BackendIndexDispatchKeyNativeFunctionNativeFunctionsGroupNativeFunctionsViewGroup)contextST)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   W/var/www/html/suriana-translation/venv/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_functionr2   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   r5   r   r-   r   r.   r1   s   ` r   with_native_function_andr7   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<	  	  	 r6   )r;   r   r   r   r-   r   r.   r1   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+   r:   s     r   r,   z3method_with_nested_native_function.<locals>.wrapperh   s-    $QqT* 	 Q<	  	  	 s   	#,)r;   r   r   r   r-   r   r.   r1   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' 	*=)	* 	* 	*r6   )r   r   rB   r
   r-   r   r.   r1   s   ` r   with_native_function_and_indexrC   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' 	,?+	, 	, 	,r6   )r   r   rF   zdict[DispatchKey, BackendIndex]r-   r   r.   r1   s   ` r    with_native_function_and_indicesrG   ~   s'     __T, , Nr   )r&   z@NativeFunctionsGroup | NativeFunctionsViewGroup | NativeFunctionr-   zIterator[None])r   Callable[[F], T]r-   rH   )r   Callable[[F, F2], T]r-   rI   )r   Callable[[S, F], T]r-   rJ   )r   Callable[[S, F3], T]r-   rK   )r   Callable[[F, BackendIndex], T]r-   rL   )r   1Callable[[F, dict[DispatchKey, BackendIndex]], T]r-   rM   )(
__future__r   
contextlibr/   typingr   r   r   r   r   r	   torchgen.localr#   torchgen.modelr
   r   r   r   r   torchgen.utilsr   r   r   collections.abcr   r   boolstrr   tuplelistr   contextmanagerr'   r2   r7   r<   r?   rC   rG    r   r   <module>r[      s   "   I I   ) ( (
 	..
./	.2
23 ^ T5,-tN/CD G 6

(#
;6r   