
    Ph                     0   d dl 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
 d dlmZ d dlmZmZmZ d dlmZmZ  edeeef   	      Zd
ee   deee      fdZdeddfdZdee   deddfdZdee   deddfdZddZedk(  r ed        e        yy)    N)SequenceTypeVarUnion)set_simple_logging)gen)native_function_manager)DispatchKeyNativeFunctionsGroupNativeFunctionsViewGroup)config	generatorNativeGroupT)boundgrouped_native_functionsreturnc                     | sg S g }dt         t        t        f   dt        fdfd| D        }t	        j
                  |t        j                        D cg c]  \  }}t        |       }}}|S c c}}w )Ngr   c                 n    t        |       5  t        j                  |       cd d d        S # 1 sw Y   y xY wN)r   r   is_supported)r   s    yC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torchgen/static_runtime/gen_static_runtime_ops.pyr   z0group_functions_by_op_name.<locals>.is_supported   s$    $Q'))!, (''s   +4c              3   4   K   | ]  } |      s|  y wr    ).0r   r   s     r   	<genexpr>z-group_functions_by_op_name.<locals>.<genexpr>"   s     K7!<?A7s   )key)	r   r
   r   bool	itertoolsgroupbyr   func_name_base_strlist)r   groupseligible_opskgroupr   s        @r   group_functions_by_op_namer&      s     $	F-24LLM -RV - L7KL -- Au 	U   Ms   A2cpp_file_pathc                 4    dd l }|j                  dd| g       y )Nr   zclang-formatz-i)
subprocess
check_call)r'   r)   s     r   clang_formatr+   0   s    >4?@    cpp_ops	file_pathc                     dj                  |       }d| d}t        |d      5 }|j                  |       d d d        t        |       y # 1 sw Y   xY w)N
a  // @lint-ignore-every CLANGTIDY HOWTOEVEN
// AUTO-GENERATED FROM: torchgen/static_runtime/gen_static_runtime_ops.py
#include <torch/csrc/jit/runtime/static/ops.h>

#include <ATen/CPUFunctions.h>
#include <ATen/InferSize.h>
#include <ATen/NativeFunctions.h>
#include <ATen/Parallel.h>
#include <ATen/ScalarOps.h>
#include <ATen/TensorUtils.h>
#include <ATen/cpu/vec/functional.h>
#include <ATen/cpu/vec/vec.h>
#include <ATen/native/EmbeddingBag.h>
#include <ATen/native/Fill.h>
#include <ATen/native/IndexingUtils.h>
#include <ATen/native/NonSymbolicBC.h>
#include <ATen/native/Resize.h>
#include <ATen/native/SharedReduceOps.h>
#include <ATen/native/TensorAdvancedIndexing.h>
#include <ATen/native/cpu/SerialStackImpl.h>
#include <ATen/native/layer_norm.h>
#include <ATen/native/quantized/cpu/fbgemm_utils.h>
#include <ATen/native/quantized/cpu/qembeddingbag.h>
#include <ATen/native/quantized/cpu/qembeddingbag_prepack.h>
#include <ATen/quantized/QTensorImpl.h>
#include <ATen/quantized/Quantizer.h>
#include <c10/core/ScalarType.h>
#include <c10/core/WrapDimMinimal.h>
#include <c10/util/irange.h>
#include <torch/csrc/jit/ir/ir.h>
#include <torch/csrc/jit/runtime/static/impl.h>
#include <torch/csrc/jit/runtime/static/te_wrapper.h>
#include <torch/csrc/jit/runtime/vararg_functions.h>
#include <torch/csrc/jit/tensorexpr/ir.h>
#include <torch/csrc/jit/tensorexpr/ir_simplifier.h>
#include <torch/csrc/jit/tensorexpr/llvm_codegen.h>
#include <torch/csrc/jit/tensorexpr/loopnest.h>

namespace torch {
namespace jit {

z*

} // namespace jit
} // namespace torch
wjoinopenwriter+   r-   r.   code	generatedfs        r   	write_cppr:   6   s[    99WD)R  S-I\ 
i			 
 
	   A

Ac                     dj                  |       }d| d}t        |d      5 }|j                  |       d d d        t        |       y # 1 sw Y   xY w)Nr0   aq  // @lint-ignore-every CLANGTIDY HOWTOEVEN
// AUTO-GENERATED FROM: torchgen/static_runtime/gen_static_runtime_ops.py
#include <gtest/gtest.h>
#include <torch/csrc/jit/runtime/static/impl.h>
#include <torch/torch.h>

#include "test_utils.h"

using namespace caffe2;
using namespace torch;
using namespace torch::jit;
using namespace torch::jit::test;
using c10::IValue;



r1   r2   r6   s        r   write_test_cppr>   k   sX    99WD  I" 
i			 
 
	r;   c                     t        j                  d      } | j                  dddd       | j                  dd	d
d       | j                  ddd
d       | j                         }t        j
                  j                  |j                  d      }t        j
                  j                  |j                  d      }t        j                  ||      }|j                  |j                  }}t        j                         }t        j                         }t        j                  |      D 	cg c]  }	t!        |	t"              r|	 }
}	t%        |
      }|D cg c]%  }|j'                  ||t(        j*                           ' }}|D cg c]  }|j'                  |       }}t        j,                  |      D 	cg c]  }	t!        |	t.              r|	 }}	t%        |      }|D cg c]%  }|j1                  ||t(        j*                           ' }}|D cg c]  }|j1                  |       }}|dgz   |z   }|dgz   |z   }t3        ||j4                         t7        ||j8                         t;        dt=        t        j                  |            z         t;        dt=        |
      z         t?        |D cg c]  }t=        |       c}      }t;        d|z         t;        dt=        |      z         t?        |D cg c]  }t=        |       c}      }t;        d|z         t;        d||z   z         y c c}	w c c}w c c}w c c}	w c c}w c c}w c c}w c c}w )NzGenerate ATen source files)descriptionz-sz--source-pathz!path to source directory for ATenzcaffe2/aten/src/ATen)helpdefaultz-pz--generated-ops-cpp-pathz5path to directory to generate op dispatcher .cpp filez6caffe2/torch/csrc/jit/runtime/static/generated_ops.cppz-tz--generated-ops-test-cpp-pathz6caffe2/benchmarks/static_runtime/test_generated_ops.ccznative/native_functions.yamlznative/tags.yamlr=   z
total grouped native ops: %dz'grouped native ops with out variant: %dz/generated functions groups with out variant: %dz
view grouped native ops: %dz#generated functions view groups: %dz
overall generated : %d) argparseArgumentParseradd_argument
parse_argsospathr3   source_pathr   parse_native_yamlnative_functionsbackend_indicesr   GenOpDispatcherGenOpTestCaseget_grouped_native_functions
isinstancer
   r&   out_variantr	   CPU$get_grouped_by_view_native_functionsr   viewr:   generated_ops_cpp_pathr>   generated_ops_test_cpp_pathprintlensum)parseroptionsnative_yaml_pathtags_yaml_pathparsed_yamlrK   rL   op_generatortest_case_generatorr   native_functions_groupssupported_functions_groupsr"   out_variant_op_resultout_variant_test_resultnative_functions_view_groupssupported_functions_view_groupsview_op_resultview_test_result	op_resulttest_resultsupported_functions_numsupported_view_functions_nums                          r   mainrm      s   $$1MNF
0&	   "DH	   'DH	   !Gww||G$7$79WXWW\\'"5"57IJN''(8.IK$$## &
 ,,.L#113 112BCCAa-. 	
C   "<<S!T 10F 	  )IJ0  
 ?Y>XF''/>X   99:JK$KAa12 	
K ! $ 'A$'# 65F 	&/+//"BC5  
 8W7VV  (7V   &0>AI)VH47GGKi778; C CD	(
c../?@
A	B
 

3c:Q6R
RS!#=>#=V#=> 

;>U
UV	
)C0L,M
MN#&#BC#BV#BC$  

/2N
NO	""%AA	Cs$" 	? 	Ds0   'L.*L3L82L=*MM.M5M__main__F)escape_newlines)r   N)rC   r   rG   typingr   r   r   libfb.py.logr   torchgenr   torchgen.contextr   torchgen.modelr	   r
   r   torchgen.static_runtimer   r   r   r&   strr+   r:   r>   rm   __name__r   r,   r   <module>rx      s      	 + + +  4 V V 5 
$&>>
?&|4h|$%2A A A2x} 2 2 2jHSM c d 0\~ zu-F r,   