xref: /aosp_15_r20/external/pytorch/torch/csrc/onnx/diagnostics/generated/rules.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 /**
4  * GENERATED CODE - DO NOT EDIT DIRECTLY
5  * This file is generated by gen_diagnostics.py.
6  * See tools/onnx/gen_diagnostics.py for more information.
7  *
8  * Diagnostic rules for PyTorch ONNX export.
9  */
10 
11 namespace torch::onnx::diagnostics {
12 
13 enum class Rule : uint32_t {
14   /**
15    * @brief Node is missing ONNX shape inference.
16    */
17   kNodeMissingOnnxShapeInference,
18 
19   /**
20    * @brief Missing symbolic function for custom PyTorch operator, cannot
21    * translate node to ONNX.
22    */
23   kMissingCustomSymbolicFunction,
24 
25   /**
26    * @brief Missing symbolic function for standard PyTorch operator, cannot
27    * translate node to ONNX.
28    */
29   kMissingStandardSymbolicFunction,
30 
31   /**
32    * @brief Operator is supported in newer opset version.
33    */
34   kOperatorSupportedInNewerOpsetVersion,
35 
36   /**
37    * @brief Transforms graph from FX IR to ONNX IR.
38    */
39   kFxGraphToOnnx,
40 
41   /**
42    * @brief Transforms an FX node to an ONNX node.
43    */
44   kFxNodeToOnnx,
45 
46   /**
47    * @brief FX graph transformation during ONNX export before converting from FX
48    * IR to ONNX IR.
49    */
50   kFxPass,
51 
52   /**
53    * @brief Cannot find symbolic function to convert the "call_function" FX node
54    * to ONNX.
55    */
56   kNoSymbolicFunctionForCallFunction,
57 
58   /**
59    * @brief Result from FX graph analysis to reveal unsupported FX nodes.
60    */
61   kUnsupportedFxNodeAnalysis,
62 
63   /**
64    * @brief Report any op level validation failure in warnings.
65    */
66   kOpLevelDebugging,
67 
68   /**
69    * @brief Find the OnnxFunction that matches the input/attribute dtypes by
70    * comparing them with their opschemas.
71    */
72   kFindOpschemaMatchedSymbolicFunction,
73 
74   /**
75    * @brief Determine if type promotion is required for the FX node. Insert cast
76    * nodes if needed.
77    */
78   kFxNodeInsertTypePromotion,
79 
80   /**
81    * @brief Find the list of OnnxFunction of the PyTorch operator in onnx
82    * registry.
83    */
84   kFindOperatorOverloadsInOnnxRegistry,
85 };
86 
87 static constexpr const char* const kPyRuleNames[] = {
88     "node_missing_onnx_shape_inference",
89     "missing_custom_symbolic_function",
90     "missing_standard_symbolic_function",
91     "operator_supported_in_newer_opset_version",
92     "fx_graph_to_onnx",
93     "fx_node_to_onnx",
94     "fx_pass",
95     "no_symbolic_function_for_call_function",
96     "unsupported_fx_node_analysis",
97     "op_level_debugging",
98     "find_opschema_matched_symbolic_function",
99     "fx_node_insert_type_promotion",
100     "find_operator_overloads_in_onnx_registry",
101 };
102 
103 } // namespace torch::onnx::diagnostics
104