1 | #pragma once |
2 | #include <vector> |
3 | #include <cstdint> |
4 | #include <string> |
5 | #include <unordered_map> |
6 | #include <algorithm> |
7 | |
8 | #include <c10/macros/Macros.h> |
9 | |
10 | #include <ATen/core/aten_interned_strings.h> |
11 | #include <ATen/core/symbol.h> |
12 | |
13 | namespace c10 { |
14 | |
15 | #define FORALL_NS_SYMBOLS(_) \ |
16 | _(namespaces, prim) \ |
17 | _(namespaces, prims) \ |
18 | _(namespaces, nvprims) \ |
19 | _(namespaces, aten) \ |
20 | _(namespaces, cuda) \ |
21 | _(namespaces, onnx) \ |
22 | _(namespaces, attr) \ |
23 | _(namespaces, scope) \ |
24 | _(namespaces, user) \ |
25 | _(namespaces, _caffe2) \ |
26 | _(namespaces, dimname) \ |
27 | _(namespaces, namespaces) \ |
28 | _(prim, Assign) \ |
29 | _(prim, BroadcastingChunk) \ |
30 | _(prim, BroadcastSizes) \ |
31 | _(prim, ReductionSizes) \ |
32 | _(prim, Constant) \ |
33 | _(prim, ChunkSizes) \ |
34 | _(prim, ConstantMKLDNNTensor) \ |
35 | _(prim, BroadcastMKLDNNTensors) \ |
36 | _(prim, MKLDNNGroup) \ |
37 | _(prim, MKLDNNHardSwish) \ |
38 | _(prim, MKLDNNHardSigmoid) \ |
39 | _(prim, MKLDNNHardTanh) \ |
40 | _(prim, MKLDNNClamp) \ |
41 | _(prim, StaticRuntimeCopyOuts) \ |
42 | _(prim, Drop) \ |
43 | _(prim, Eval) \ |
44 | _(prim, Expand) /* onnx */ \ |
45 | _(prim, FusionGroup) \ |
46 | _(prim, CudaFusionGroup) \ |
47 | _(prim, CudaFusionGuard) \ |
48 | _(prim, oneDNNFusionGroup) \ |
49 | _(prim, oneDNNFusionGuard) \ |
50 | _(prim, FunctionalGraph) \ |
51 | _(prim, add_optional) \ |
52 | _(prim, view_copy) \ |
53 | _(prim, permute_copy) \ |
54 | _(prim, reshape_copy) \ |
55 | _(prim, squeeze_copy) \ |
56 | _(prim, t_copy) \ |
57 | _(prim, transpose_copy) \ |
58 | _(prim, unsqueeze_copy) \ |
59 | _(prim, flatten_copy) \ |
60 | _(prim, expand_copy) \ |
61 | _(prim, expand_as_copy) \ |
62 | _(prim, DifferentiableGraph) \ |
63 | _(prim, TensorExprGroup) \ |
64 | _(prim, TensorExprDynamicGroup) \ |
65 | _(prim, StaticSubgraph) \ |
66 | _(prim, If) \ |
67 | _(prim, Jump) /* debug */ \ |
68 | _(prim, JumpNZ) /* debug */ \ |
69 | _(prim, JumpZ) /* debug */ \ |
70 | _(prim, Load) \ |
71 | _(prim, Loop) \ |
72 | _(prim, Param) \ |
73 | _(prim, PackPadded) /* onnx */ \ |
74 | _(prim, PadPacked) /* onnx */ \ |
75 | _(prim, Placeholder) /* debug */ \ |
76 | _(prim, Print) \ |
77 | _(prim, EmptyListLiteral) \ |
78 | _(prim, LegacyTypedConstructor) \ |
79 | _(prim, PythonOp) \ |
80 | _(prim, IgnoredPythonOp) \ |
81 | _(prim, Reverse) \ |
82 | _(prim, Return) \ |
83 | _(prim, ReturnStmt) \ |
84 | _(prim, BreakStmt) \ |
85 | _(prim, ContinueStmt) \ |
86 | _(prim, ComprehensionScope) \ |
87 | _(prim, Store) \ |
88 | _(prim, AutogradZero) \ |
89 | _(prim, AutogradAnyNonZero) \ |
90 | _(prim, AutogradAllNonZero) \ |
91 | _(prim, AutogradAllZero) \ |
92 | _(prim, Starred) \ |
93 | _(prim, TupleConstruct) \ |
94 | _(prim, TupleUnpack) \ |
95 | _(prim, TupleIndex) \ |
96 | _(prim, TupleSlice) \ |
97 | _(prim, ListConstruct) \ |
98 | _(prim, ListUnpack) \ |
99 | _(prim, DictConstruct) \ |
100 | _(prim, ModuleContainerIndex) \ |
101 | _(prim, EnumName) \ |
102 | _(prim, EnumValue) \ |
103 | _(prim, StringIndex) \ |
104 | _(prim, NumToTensor) \ |
105 | _(prim, Uninitialized) \ |
106 | _(prim, VarConcat) \ |
107 | _(prim, VarStack) \ |
108 | _(prim, With) \ |
109 | _(prim, Enter) \ |
110 | _(prim, Exit) \ |
111 | _(prim, IfThenElse) \ |
112 | _(aten, Bool) \ |
113 | _(aten, Int) \ |
114 | _(aten, FloatImplicit) \ |
115 | _(aten, ComplexImplicit) \ |
116 | _(aten, IntImplicit) \ |
117 | _(aten, ScalarImplicit) \ |
118 | _(aten, Float) \ |
119 | _(aten, Complex) \ |
120 | _(aten, str) \ |
121 | _(aten, Delete) \ |
122 | _(prim, device) \ |
123 | _(prim, dtype) \ |
124 | _(prim, layout) \ |
125 | _(prim, id) \ |
126 | _(prim, requires_grad) \ |
127 | _(prim, MakeTestTensor) /* test */ \ |
128 | _(prim, AutogradAdd) \ |
129 | _(prim, GradOf) \ |
130 | _(aten, grad) \ |
131 | _(aten, backward) \ |
132 | _(prim, Guard) \ |
133 | _(prim, BailOut) \ |
134 | _(prim, TypeCheck) \ |
135 | _(prim, RequiresGradCheck) \ |
136 | _(prim, FallbackGraph) \ |
137 | _(prim, FusedConcat) \ |
138 | _(prim, ConstantChunk) \ |
139 | _(prim, MMTreeReduce) \ |
140 | _(prim, MMBatchSide) \ |
141 | _(prim, list) \ |
142 | _(prim, dict) \ |
143 | _(prim, min) \ |
144 | _(prim, max) \ |
145 | _(prim, abs) \ |
146 | _(aten, divmod) \ |
147 | _(prim, zip) \ |
148 | _(prim, enumerate) \ |
149 | _(prim, range) \ |
150 | _(prim, rangelist) \ |
151 | _(prim, isinstance) \ |
152 | _(prim, tolist) \ |
153 | _(prim, unchecked_cast) \ |
154 | _(aten, _grad_sum_to_size) \ |
155 | _(aten, _size_if_not_equal) \ |
156 | _(aten, _ncf_unsqueeze) \ |
157 | _(aten, warn) \ |
158 | _(aten, sorted) \ |
159 | _(aten, floordiv) \ |
160 | _(aten, __range_length) \ |
161 | _(aten, __derive_index) \ |
162 | _(aten, __round_to_zero_floordiv) \ |
163 | _(aten, is_scripting) \ |
164 | _(aten, _unwrap_optional) \ |
165 | _(prim, fork) \ |
166 | _(prim, awaitable) \ |
167 | _(prim, forkClosure) \ |
168 | _(prim, awaitableClosure) \ |
169 | _(prim, awaitable_nowait) \ |
170 | _(prim, awaitable_wait) \ |
171 | _(prim, RaiseException) \ |
172 | _(prim, Closure) \ |
173 | _(prim, CreateObject) \ |
174 | _(prim, SetAttr) \ |
175 | _(prim, GetAttr) \ |
176 | _(prim, HasAttr) \ |
177 | _(prim, profile) \ |
178 | _(prim, profile_ivalue) \ |
179 | _(prim, AddStatValue) \ |
180 | _(prim, TimePoint) \ |
181 | _(prim, CallFunction) \ |
182 | _(prim, CallMethod) \ |
183 | _(prim, LoopContinuation) \ |
184 | _(prim, annotate) \ |
185 | _(prim, TracedModuleForward) \ |
186 | _(prim, TracedFork) \ |
187 | _(prim, TracedAttr) \ |
188 | _(prim, rpc_async) \ |
189 | _(prim, rpc_sync) \ |
190 | _(prim, rpc_remote) \ |
191 | _(prim, is_cuda) \ |
192 | _(aten, append) \ |
193 | _(aten, as_tensor) \ |
194 | _(aten, adaptive_avg_pool2d_backward) \ |
195 | _(aten, dim) \ |
196 | _(aten, format) \ |
197 | _(aten, percentFormat) \ |
198 | _(aten, __not__) \ |
199 | _(aten, __is__) \ |
200 | _(aten, __isnot__) \ |
201 | _(aten, _ger) \ |
202 | _(aten, __getitem__) \ |
203 | _(aten, _set_item) \ |
204 | _(aten, manual_seed) \ |
205 | _(aten, device) \ |
206 | _(aten, hash) \ |
207 | _(aten, len) \ |
208 | _(aten, list) \ |
209 | _(aten, dict) \ |
210 | _(aten, wait) \ |
211 | _(aten, save) \ |
212 | _(aten, keys) \ |
213 | _(aten, ord) \ |
214 | _(aten, chr) \ |
215 | _(aten, hex) \ |
216 | _(aten, oct) \ |
217 | _(aten, clear) \ |
218 | _(aten, setdefault) \ |
219 | _(aten, bin) \ |
220 | _(aten, pop) \ |
221 | _(aten, insert) \ |
222 | _(aten, tensor) \ |
223 | _(prim, unchecked_unwrap_optional) \ |
224 | _(aten, __contains__) \ |
225 | _(prim, BailoutTemplate) \ |
226 | _(prim, grad) \ |
227 | _(cuda, _set_device) \ |
228 | _(cuda, set_stream) \ |
229 | _(cuda, _current_device) \ |
230 | _(cuda, synchronize) \ |
231 | _(aten, has_torch_function) \ |
232 | _(aten, is_autocast_enabled) \ |
233 | _(aten, is_autocast_cpu_enabled) \ |
234 | FORALL_ATEN_BASE_SYMBOLS(_) \ |
235 | _(onnx, Add) \ |
236 | _(onnx, Concat) \ |
237 | _(onnx, Constant) \ |
238 | _(onnx, ConstantFill) \ |
239 | _(onnx, Div) \ |
240 | _(onnx, GRU) \ |
241 | _(onnx, Gather) \ |
242 | _(onnx, Gemm) \ |
243 | _(onnx, LSTM) \ |
244 | _(onnx, MatMul) \ |
245 | _(onnx, Min) \ |
246 | _(onnx, Max) \ |
247 | _(onnx, Mul) \ |
248 | _(onnx, Pow) \ |
249 | _(onnx, RNN) \ |
250 | _(onnx, Shape) \ |
251 | _(onnx, Size) \ |
252 | _(onnx, Slice) \ |
253 | _(onnx, Softmax) \ |
254 | _(onnx, Squeeze) \ |
255 | _(onnx, Sub) \ |
256 | _(onnx, Transpose) \ |
257 | _(onnx, Unsqueeze) \ |
258 | _(onnx, Loop) \ |
259 | _(onnx, If) \ |
260 | _(onnx, Reshape) \ |
261 | _(onnx, Expand) \ |
262 | _(onnx, Equal) \ |
263 | _(onnx, Greater) \ |
264 | _(onnx, GreaterOrEqual) \ |
265 | _(onnx, Less) \ |
266 | _(onnx, LessOrEqual) \ |
267 | _(onnx, Not) \ |
268 | _(aten, ATen) \ |
269 | _(onnx, Split) \ |
270 | _(onnx, ConstantOfShape) \ |
271 | _(onnx, Cast) \ |
272 | _(onnx, Mod) \ |
273 | _(onnx, Sqrt) \ |
274 | _(onnx, SplitToSequence) \ |
275 | _(onnx, SequenceAt) \ |
276 | _(onnx, SequenceConstruct) \ |
277 | _(onnx, SequenceEmpty) \ |
278 | _(onnx, SequenceInsert) \ |
279 | _(onnx, SequenceErase) \ |
280 | _(onnx, ConcatFromSequence) \ |
281 | _(onnx, Identity) \ |
282 | _(onnx, SoftmaxCrossEntropyLoss) \ |
283 | _(onnx, NegativeLogLikelihoodLoss) \ |
284 | _(onnx, LogSoftmax) \ |
285 | _(onnx, ReduceL1) \ |
286 | _(onnx, ReduceL2) \ |
287 | _(onnx, Conv) \ |
288 | _(onnx, BatchNormalization) \ |
289 | _(onnx, ReduceMean) \ |
290 | _(onnx, ReduceProd) \ |
291 | _(onnx, Relu) \ |
292 | _(onnx, Neg) \ |
293 | _(onnx, NonZero) \ |
294 | _(onnx, Range) \ |
295 | _(onnx, Tile) \ |
296 | _(onnx, Where) \ |
297 | _(onnx, Optional) \ |
298 | _(onnx, OptionalGetElement) \ |
299 | _(onnx, OptionalHasElement) \ |
300 | FORALL_ATTR_BASE_SYMBOLS(_) \ |
301 | _(attr, Subgraph) \ |
302 | _(attr, ReverseSubgraph) \ |
303 | _(attr, f_real_outputs) \ |
304 | _(attr, df_input_vjps) \ |
305 | _(attr, df_input_captured_inputs) \ |
306 | _(attr, df_input_captured_outputs) \ |
307 | _(attr, df_output_vjps) \ |
308 | _(attr, axes) \ |
309 | _(attr, symbolic_shape_inputs) \ |
310 | _(attr, allow_stack_outputs) \ |
311 | _(attr, striding_inputs_desc) \ |
312 | _(attr, striding_outputs_desc) \ |
313 | _(attr, broadcast) \ |
314 | _(attr, direction) \ |
315 | _(attr, ends) \ |
316 | _(attr, inplace) \ |
317 | _(attr, input_as_shape) \ |
318 | _(attr, is_zero) \ |
319 | _(attr, num_none) \ |
320 | _(attr, num_present) \ |
321 | _(attr, perm) \ |
322 | _(attr, starts) \ |
323 | _(attr, profiled_type) \ |
324 | _(attr, transA) \ |
325 | _(attr, transB) \ |
326 | _(attr, name) \ |
327 | _(attr, module) \ |
328 | _(attr, beg) \ |
329 | _(attr, idx) \ |
330 | _(attr, split) \ |
331 | _(attr, slot) \ |
332 | _(attr, kinds) \ |
333 | _(attr, types) \ |
334 | _(attr, scope) \ |
335 | _(attr, keepdims) \ |
336 | _(attr, cache_id) \ |
337 | _(attr, new_axis) \ |
338 | _(attr, warn_id) \ |
339 | _(attr, output_layouts) \ |
340 | _(attr, allowzero) \ |
341 | _(attr, seen_none) \ |
342 | _(attr, overload_name) |
343 | |
344 | enum class _keys : unique_t { |
345 | #define DEFINE_KEY(ns, s) ns##_##s, |
346 | FORALL_NS_SYMBOLS(DEFINE_KEY) |
347 | #undef DEFINE_KEY |
348 | num_symbols |
349 | }; |
350 | |
351 | #define DEFINE_SYMBOL(ns, s) \ |
352 | namespace ns { constexpr Symbol s(static_cast<unique_t>(_keys::ns##_##s)); } |
353 | FORALL_NS_SYMBOLS(DEFINE_SYMBOL) |
354 | #undef DEFINE_SYMBOL |
355 | |
356 | } // namespace c10 |
357 | |