
    Ph                        d Z ddlZddlZddlmZ ddlmZ ddlmZm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ 	 ddededededededdfdZdededededdf
dZddZedk(  r e        yy)a~  
To run this file by hand from the root of the PyTorch
repository, run:

python -m tools.autograd.gen_autograd        aten/src/ATen/native/native_functions.yaml        aten/src/ATen/native/tags.yaml        $OUTPUT_DIR        tools/autograd

Where $OUTPUT_DIR is where you would like the files to be
generated.  In the full build system, OUTPUT_DIR is
torch/csrc/autograd/generated/
    N)List)cpp)match_differentiability_info'NativeFunctionWithDifferentiabilityInfo)parse_native_yaml)SelectiveBuilder   )gen_python_functions)gen_autograd_functions_libgen_autograd_functions_python)gen_inplace_or_view_type)gen_trace_type)gen_variable_factories)gen_variable_type)load_derivativesnative_functions_path	tags_pathoutautograd_diroperator_selectordisable_autogradreturnc                    t        t        j                  j                  |d      | |      \  }}t        j                  j                  |d      }t	        | |      j
                  }	t        t        |j                  |	      d       }
t        |
|      }|s,t        || ||||       t        || |||       t        ||	|       t        |||       t        || ||       y )Nderivatives.yaml	templatesc                 @    t        j                  | j                        S )N)r   namefunc)fs    rC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torchgen/packaged/autograd/gen_autograd.py<lambda>zgen_autograd.<locals>.<lambda>E   s    chhqvv&    )key)r   ospathjoinr   native_functionssortedfilter(is_native_function_selected_for_trainingr   r   r   r   r   r   )r   r   r   r   r   r   differentiability_infosused_dispatch_keystemplate_pathnative_funcsfnsfns_with_diff_infoss               r    gen_autogradr1   1   s     3C
\#568My3// GGLL{;M$%:IFWWL
FF	
 '	C 	%S*AB 
 !	
 	!&	3F	

 	sL-8s$;]K 3 5y-Pr"   c                 ,   t        t        j                  j                  |d      | |      \  }}t        j                  j                  |d      }t	        |||       t        j                  j                  |d      }t        j                  || |||       y )Nr   r   zdeprecated.yaml)r   r$   r%   r&   r   r
   gen)r   r   r   r   r+   _r-   deprecated_paths           r    gen_autograd_pythonr6   c   s     "2
\#568My"Q GGLL{;M "#'>N ggll<1BCO"Ir"   c                     t        j                  d      } | j                  ddd       | j                  ddd       | j                  d	d
d       | j                  ddd       | j                         }t	        |j
                  |j                  |j                  |j                  t        j                                y )Nz"Generate autograd C++ files script)descriptionr'   NATIVEzpath to native_functions.yaml)metavarhelptagszpath to tags.yamlr   OUTzpath to output directoryautogradAUTOGRADzpath to autograd directory)argparseArgumentParseradd_argument
parse_argsr1   r'   r<   r   r>   r   get_nop_selector)parserargss     r    mainrG   y   s    $$1UVF
H3R   7JK
u3MN
J-I   D		))+r"   __main__)F)r   N)__doc__r@   r$   typingr   torchgen.apir   torchgen.api.autogradr   r   torchgen.genr   !torchgen.selective_build.selectorr    r
   gen_autograd_functionsr   r   r   r   r   r   r   strboolr1   r6   rG   __name__ r"   r    <module>rU      s   0  	   + > " ? * : 0 . #/Q/Q/Q 
/Q 	/Q
 (/Q /Q 
/Qd 
 	
 
,( zF r"   