
    iri              	      `   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%dS )#    )annotationsN)AnyTYPE_CHECKINGTypeVar)BackendIndexDispatchKeyNativeFunctionNativeFunctionsGroupNativeFunctionsViewGroup)contextST)CallableIteratorFF2F3g@NativeFunctionsGroup | NativeFunctionsViewGroup | NativeFunctionreturnIterator[None]c              #  R  K   t          | t                    r| j        nt          | t                    r| j        n| t          fd          5  t          j        j        j	                  5  d V  d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nc                 (    d j          d j         S )Nzin native_functions.yaml line z:
  )locfunc)fs   h/var/www/html/bestrading.cuttalo.com/models/btc_v9/venv/lib/python3.11/site-packages/torchgen/context.py<lambda>z)native_function_manager.<locals>.<lambda><   s    N!%NNafNN     )!use_const_ref_for_mutable_tensorsuse_ilistref_for_tensor_lists)

isinstancer
   outr   viewr   localparametrizer    part_of_structured_group)r   r   s    @r   native_function_managerr(   -   sH      !)** 

 E	A/	0	0 F	NNNN	O	O  ./.Q*+*D
 
 
 	 	 EEE		 	 	 	 	 	 	 	 	 	 	 	 	 	 	                 s6   !B3B8BB	BB	BB #B r   Callable[[F], T]c                H     t          j                   d fd            }|S )Nr   r   r   r   c                l    t          |           5   |           cd d d            S # 1 swxY w Y   d S Nr(   )r   r   s    r   wrapperz%with_native_function.<locals>.wrapperJ   s    $Q'' 	 	477	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   )--)r   r   r   r   	functoolswrapsr   r.   s   ` r   with_native_functionr3   I   s=    _T      Nr   Callable[[F, F2], T]c                H     t          j                   d fd            }|S )	Nr   r   f2r   r   r   c                n    t          |           5   | |          cd d d            S # 1 swxY w Y   d S r,   r-   )r   r6   r   s     r   r.   z)with_native_function_and.<locals>.wrapperS   s     %Q'' 	 	42;;	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   *..)r   r   r6   r   r   r   r/   r2   s   ` r   with_native_function_andr9   R   s=    _T     
 Nr   Callable[[S, F], T]c                H     t          j                   d fd            }|S )	Nslfr   r   r   r   r   c                n    t          |          5   | |          cd d d            S # 1 swxY w Y   d S r,   r-   r<   r   r   s     r   r.   z,method_with_native_function.<locals>.wrapper]   s    $Q'' 	  	 4Q<<	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 r8   )r<   r   r   r   r   r   r/   r2   s   ` r   method_with_native_functionr?   \   s=    _T            Nr   Callable[[S, F3], T]c                H     t          j                   d fd            }|S )	Nr<   r   r   r   r   r   c                z    t          |d                   5   | |          cd d d            S # 1 swxY w Y   d S )Nr   r-   r>   s     r   r.   z3method_with_nested_native_function.<locals>.wrapperh   s    $QqT** 	  	 4Q<<	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 s   044)r<   r   r   r   r   r   r/   r2   s   ` r   "method_with_nested_native_functionrC   e   s?     _T            Nr   Callable[[F, BackendIndex], T]c                H     t          j                   d fd            }|S )	Nr   r   backend_indexr   r   r   c                n    t          |           5   | |          cd d d            S # 1 swxY w Y   d S r,   r-   )r   rF   r   s     r   r.   z/with_native_function_and_index.<locals>.wrapperu   s    $Q'' 	* 	*4=))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*r8   )r   r   rF   r   r   r   r/   r2   s   ` r   with_native_function_and_indexrH   r   s?     _T* * * * * * Nr   1Callable[[F, dict[DispatchKey, BackendIndex]], T]c                H     t          j                   d fd            }|S )	Nr   r   backend_indicesdict[DispatchKey, BackendIndex]r   r   c                n    t          |           5   | |          cd d d            S # 1 swxY w Y   d S r,   r-   )r   rK   r   s     r   r.   z1with_native_function_and_indices.<locals>.wrapper   s    $Q'' 	, 	,4?++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,r8   )r   r   rK   rL   r   r   r/   r2   s   ` r    with_native_function_and_indicesrN   ~   s?     _T, , , , , , Nr   )r   r   r   r   )r   r)   r   r)   )r   r4   r   r4   )r   r:   r   r:   )r   r@   r   r@   )r   rD   r   rD   )r   rI   r   rI   )&
__future__r   
contextlibr0   typingr   r   r   torchgen.localr%   torchgen.modelr   r   r	   r
   r   torchgen.utilsr   r   r   collections.abcr   r   r   boolstrr   tuplelistr   contextmanagerr(   r3   r9   r?   rC   rH   rN    r   r   <module>r\      s   " " " " " "         . . . . . . . . . .                    ) ( ( ( ( ( ( ( ( (  322222222
 G))--  WT  WT5,-tN/CDD    6                    r   