xref: /aosp_15_r20/external/pytorch/aten/src/ATen/core/dispatch/ObservedOperators.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #include <ATen/core/dispatch/ObservedOperators.h>
2 
3 #include <string>
4 #include <unordered_set>
5 
6 namespace c10 {
7 
8 /* static */
getUnobservedOperatorList()9 std::unordered_set<std::string>& ObservedOperators::getUnobservedOperatorList() {
10   // names of the operators that should not be observed
11   static std::unordered_set<std::string> not_observed_ops = {
12     "aten::size",
13     "aten::is_leaf",
14     "aten::output_nr",
15     "aten::_version",
16     "aten::is_complex",
17     "profiler::_record_function_enter",
18     "profiler::_record_function_enter_new",
19     "profiler::_record_function_exit",
20   };
21   return not_observed_ops;
22 }
23 
24 /* static */
isObserved(const OperatorName & name)25 bool ObservedOperators::isObserved(const OperatorName& name) {
26   return !ObservedOperators::getUnobservedOperatorList().count(name.name);
27 }
28 
29 } // namespace c10
30