
    VhA                        d Z ddlZddlmZ ddlmZ 	  G d dej                        Z G d dej                        Z G d	 d
ej                        Z	 G d dej                        Z
 G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Z G d dej                        Zej(                   G d d ej*                               Z e       Zy)!z
GENERATED CODE - DO NOT EDIT DIRECTLY
This file is generated by gen_diagnostics.py.
See tools/onnx/gen_diagnostics.py for more information.

Diagnostic rules for PyTorch ONNX export.
    N)Tuple)infrac                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_NodeMissingOnnxShapeInference%Node is missing ONNX shape inference.returnc                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'The shape inference of {op_name} type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.'
        op_namemessage_default_templateformatselfr   s     W/home/dcms/DCMS/lib/python3.12/site-packages/torch/onnx/_internal/diagnostics/_rules.pyformat_messagez-_NodeMissingOnnxShapeInference.format_message       
 ,,33G3DD    levelc                 ,    | || j                  |      fS )a  Returns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'The shape inference of {op_name} type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.'
        r
   r   r   r   r   s      r   r   z%_NodeMissingOnnxShapeInference.format"        UD///@@@r   N__name__
__module____qualname____doc__strr   r   Levelr   Ruler    r   r   r   r      sC    /E EA[[A	uzz5;;+	,Ar   r   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_MissingCustomSymbolicFunctionUMissing symbolic function for custom PyTorch operator, cannot translate node to ONNX.r   c                 :    | j                   j                  |      S )a  Returns the formatted default message of this Rule.

        Message template: 'ONNX export failed on an operator with unrecognized namespace {op_name}. If you are trying to export a custom operator, make sure you registered it with the right domain and version.'
        r
   r   r   s     r   r   z-_MissingCustomSymbolicFunction.format_message/   r   r   r   c                 ,    | || j                  |      fS )a  Returns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'ONNX export failed on an operator with unrecognized namespace {op_name}. If you are trying to export a custom operator, make sure you registered it with the right domain and version.'
        r
   r   r   s      r   r   z%_MissingCustomSymbolicFunction.format6   r   r   Nr   r"   r   r   r$   r$   ,   sC    _E EA[[A	uzz5;;+	,Ar   r$   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y) _MissingStandardSymbolicFunctionWMissing symbolic function for standard PyTorch operator, cannot translate node to ONNX.r   c                 >    | j                   j                  |||      S )a  Returns the formatted default message of this Rule.

        Message template: "Exporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: {issue_url}."
        r   opset_version	issue_urlr   )r   r   r-   r.   s       r   r   z/_MissingStandardSymbolicFunction.format_messageC   s)     ,,33=I 4 
 	
r   r   c                 0    | || j                  |||      fS )a  Returns a tuple of (Rule, Level, message) for this Rule.

        Message template: "Exporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: {issue_url}."
        r,   r   )r   r   r   r-   r.   s        r   r   z'_MissingStandardSymbolicFunction.formatN   s.     }	   
 	
r   Nr   r"   r   r   r)   r)   @   s?    a	
		

[[
	uzz5;;+	,
r   r)   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)%_OperatorSupportedInNewerOpsetVersion-Operator is supported in newer opset version.r   c                 >    | j                   j                  |||      S )a  Returns the formatted default message of this Rule.

        Message template: "Exporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Support for this operator was added in version {supported_opset_version}, try exporting with this version."
        r   r-   supported_opset_versionr   )r   r   r-   r5   s       r   r   z4_OperatorSupportedInNewerOpsetVersion.format_messagea   s+     ,,33'$; 4 
 	
r   r   c                 0    | || j                  |||      fS )a$  Returns a tuple of (Rule, Level, message) for this Rule.

        Message template: "Exporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Support for this operator was added in version {supported_opset_version}, try exporting with this version."
        r4   r   )r   r   r   r-   r5   s        r   r   z,_OperatorSupportedInNewerOpsetVersion.formatn   s0     +(?   
 	
r   Nr   r"   r   r   r1   r1   ^   s?    7
	

[[
	uzz5;;+	,
r   r1   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_FxGraphToOnnx'Transforms graph from FX IR to ONNX IR.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'Transforming FX graph {graph_name} to ONNX graph.'
        
graph_namer   )r   r<   s     r   r   z_FxGraphToOnnx.format_message   s    
 ,,33z3JJr   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Transforming FX graph {graph_name} to ONNX graph.'
        r;   r   )r   r   r<   s      r   r   z_FxGraphToOnnx.format   s     UD//:/FFFr   Nr   r"   r   r   r8   r8      sC    1KC KG[[G	uzz5;;+	,Gr   r8   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_FxNodeToOnnx&Transforms an FX node to an ONNX node.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'Transforming FX node {node_repr} to ONNX node.'
        	node_reprr   )r   rC   s     r   r   z_FxNodeToOnnx.format_message       
 ,,33i3HHr   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Transforming FX node {node_repr} to ONNX node.'
        rB   r   )r   r   rC   s      r   r   z_FxNodeToOnnx.format        UD//)/DDDr   Nr   r"   r   r   r?   r?      sC    0I3 IE[[E	uzz5;;+	,Er   r?   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_FxPassSFX graph transformation during ONNX export before converting from FX IR to ONNX IR.r   c                 :    | j                   j                  |      S )zsReturns the formatted default message of this Rule.

        Message template: 'Running {pass_name} pass.'
        	pass_namer   )r   rL   s     r   r   z_FxPass.format_message   rD   r   r   c                 ,    | || j                  |      fS )zxReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Running {pass_name} pass.'
        rK   r   )r   r   rL   s      r   r   z_FxPass.format   rF   r   Nr   r"   r   r   rH   rH      sC    ]I3 IE[[E	uzz5;;+	,Er   rH   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)"_NoSymbolicFunctionForCallFunctionMCannot find symbolic function to convert the "call_function" FX node to ONNX.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'No symbolic function to convert the "call_function" node {target} to ONNX. '
        targetr   r   rS   s     r   r   z1_NoSymbolicFunctionForCallFunction.format_message       
 ,,3363BBr   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'No symbolic function to convert the "call_function" node {target} to ONNX. '
        rR   r   r   r   rS   s      r   r   z)_NoSymbolicFunctionForCallFunction.format        UD//v/>>>r   Nr   r"   r   r   rO   rO      s@    WC C?[[?	uzz5;;+	,?r   rO   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_UnsupportedFxNodeAnalysis=Result from FX graph analysis to reveal unsupported FX nodes.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'Unsupported FX nodes: {node_op_to_target_mapping}. '
        node_op_to_target_mappingr   )r   r^   s     r   r   z)_UnsupportedFxNodeAnalysis.format_message   s%     ,,33&? 4 
 	
r   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Unsupported FX nodes: {node_op_to_target_mapping}. '
        r]   r   )r   r   r^   s      r   r   z!_UnsupportedFxNodeAnalysis.format   s&     :ST
 	
r   Nr   r"   r   r   rZ   rZ      s?    G	
		

[[
	uzz5;;+	,
r   rZ   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_OpLevelDebugging3Report any op level validation failure in warnings.r   c                 <    | j                   j                  ||      S )zReturns the formatted default message of this Rule.

        Message template: 'FX node: {node} and its onnx function: {symbolic_fn} fails on op level validation.'
        nodesymbolic_fnr   )r   re   rf   s      r   r   z _OpLevelDebugging.format_message   s     
 ,,33;3WWr   r   c                 .    | || j                  ||      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'FX node: {node} and its onnx function: {symbolic_fn} fails on op level validation.'
        rd   r   )r   r   re   rf   s       r   r   z_OpLevelDebugging.format   s!     UD//T{/SSSr   Nr   r"   r   r   ra   ra      sC    =X3 XT[[T	uzz5;;+	,Tr   ra   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)$_FindOpschemaMatchedSymbolicFunctioneFind the OnnxFunction that matches the input/attribute dtypes by comparing them with their opschemas.r   c                 <    | j                   j                  ||      S )zReturns the formatted default message of this Rule.

        Message template: 'The OnnxFunction: {symbolic_fn} is the nearest match of the node {node}.'
        rf   re   r   )r   rf   re   s      r   r   z3_FindOpschemaMatchedSymbolicFunction.format_message  s!    
 ,,33RV3WWr   r   c                 .    | || j                  ||      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'The OnnxFunction: {symbolic_fn} is the nearest match of the node {node}.'
        rl   r   )r   r   rf   re   s       r   r   z+_FindOpschemaMatchedSymbolicFunction.format
  s!     UD//Kd/SSSr   Nr   r"   r   r   ri   ri      sC    oX3 XT[[T	uzz5;;+	,Tr   ri   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)_FxNodeInsertTypePromotionUDetermine if type promotion is required for the FX node. Insert cast nodes if needed.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'Performing explicit type promotion for node {target}. '
        rR   r   rT   s     r   r   z)_FxNodeInsertTypePromotion.format_message  rU   r   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Performing explicit type promotion for node {target}. '
        rR   r   rW   s      r   r   z!_FxNodeInsertTypePromotion.format  rX   r   Nr   r"   r   r   ro   ro     s@    _C C?[[?	uzz5;;+	,?r   ro   c                   t    e Zd ZdZdefdZdej                  deej                  ej                  ef   fdZ
y)$_FindOperatorOverloadsInOnnxRegistryGFind the list of OnnxFunction of the PyTorch operator in onnx registry.r   c                 :    | j                   j                  |      S )zReturns the formatted default message of this Rule.

        Message template: 'Checking if the FX node: {node} is supported in onnx registry.'
        re   r   )r   re   s     r   r   z3_FindOperatorOverloadsInOnnxRegistry.format_message+  s    
 ,,333>>r   r   c                 ,    | || j                  |      fS )zReturns a tuple of (Rule, Level, message) for this Rule.

        Message template: 'Checking if the FX node: {node} is supported in onnx registry.'
        rw   r   )r   r   re   s      r   r   z+_FindOperatorOverloadsInOnnxRegistry.format2  s     UD//T/:::r   Nr   r"   r   r   rt   rt   (  s>    Q?c ?;[[;	uzz5;;+	,;r   rt   c                   X   e Zd ZU  ej                   ej                  d[i ddddidddddd	iid
dg ddd      Zeed<   	  ej                   e	j                  d[i ddddiddddddiid
dg ddd      Z
e	ed<   	  ej                   ej                  d[i ddddiddddddiid
dg ddd      Zeed<   	  ej                   ej                  d[i ddddidddddd iid
dg ddd      Zeed!<   	  ej                   ej                  d[i d"d#dd$id$d%dddd&iid
dg ddd      Zeed'<   	  ej                   ej                  d[i d(d)dd*id*d+dddd,iid
dg ddd      Zeed-<   	  ej                   ej                  d[i d.d/dd0id0d1dddd2iid
dg ddd      Zeed3<   	  ej                   ej                  d[i d4d5dd6id7d8dddd9iid
dg ddd      Zeed:<   	  ej                   ej                  d[i d;d<dd=id=d>dddd?iid
dg ddd      Zeed@<   	  ej                   ej                  d[i dAdBddCidCdDddddEiid
dg ddd      ZeedF<   	  ej                   ej                  d[i dGdHddIidJdKddddLiid
dg ddd      ZeedM<   	  ej                   ej                  d[i dNdOddPidPdQddddRiid
dg ddd      ZeedS<   	  ej                   ej                  d[i dTdUddVidWdXddddYiid
dg ddd      Z eedZ<   y
)\	_POERulesPOE0001z!node-missing-onnx-shape-inferencetextr   zxNode is missing ONNX shape inference. This usually happens when the node is not valid under standard ONNX operator spec.zyNode is missing ONNX shape inference.
This usually happens when the node is not valid under standard ONNX operator spec.
)r|   markdowndefaultzThe shape inference of {op_name} type is missing, so it may result in wrong shape inference for the exported graph. Please consider adding it in symbolic function.NF)
deprecatedtags)idnameshort_descriptionfull_descriptionmessage_stringshelp_uri
properties)r~   init!node_missing_onnx_shape_inferencePOE0002z missing-custom-symbolic-functionr%   zVMissing symbolic function for custom PyTorch operator, cannot translate node to ONNX.
zONNX export failed on an operator with unrecognized namespace {op_name}. If you are trying to export a custom operator, make sure you registered it with the right domain and version. missing_custom_symbolic_functionPOE0003z"missing-standard-symbolic-functionr*   zXMissing symbolic function for standard PyTorch operator, cannot translate node to ONNX.
zExporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: {issue_url}."missing_standard_symbolic_functionPOE0004z)operator-supported-in-newer-opset-versionr2   z{Operator is supported in newer opset version.

Example:
```python
torch.onnx.export(model, args, ..., opset_version=9)
```
zExporting the operator '{op_name}' to ONNX opset version {opset_version} is not supported. Support for this operator was added in version {supported_opset_version}, try exporting with this version.)operator_supported_in_newer_opset_versionFXE0007zfx-graph-to-onnxr9   a]  This diagnostic tracks the transformation process from an FX Graph (in FX IR) to an ONNX Graph (in ONNX IR).

## Key Representations:

- **FX Graph**: The graph in FX IR produced by dynamo or symbolic tracing.
- **ONNX Graph**: The graph in ONNX IR and [operators](https://onnx.ai/onnx/operators/).

## Additional Notes:

- Prior to this transformation step, the FX graph undergoes preprocessing through multiple FX passes.
  To gain insight into these transformations, refer to diagnostic `FXE0010`.
- To enable a detailed view of the graph transformation in progress within this diagnostic, switch to the DEBUG mode.

  - Set DiagnosticOptions.verbosity_level to logging.DEBUG.
  - Activate the environment variable TORCH_LOGS='onnx_diagnostics'.

- For specific information related to node-level FX to ONNX transformations, explore the diagnostic `FXE0008`.
z1Transforming FX graph {graph_name} to ONNX graph.fx_graph_to_onnxFXE0008zfx-node-to-onnxr@   a  This diagnostic tracks the transformation process from an FX Node to ONNX [Operators](https://onnx.ai/onnx/operators/).

The process of converting FX Node to ONNX Node involves dealing with six distinct node types:
  1. `placeholder`: Represents a module input, maps to an ONNX graph input.
  2. `call_module`: Symbolizes a call to a submodule, maps to an ONNX
  3. `call_method`: Symbolizes a method call. Not yet implemented.
  4. `call_function`: Symbolizes a function call. [Core ATen](https://pytorch.org/docs/stable/ir.html#core-aten-ir) is expected
    as the function call target. The mapping from ATen to ONNX is implemented by [ONNXScript torchlib](https://github.com/microsoft/onnxscript/tree/main/onnxscript/function_libs/torch_lib/ops).
    This [guide](https://pytorch.org/docs/stable/onnx.html#onnx-script-functions) shows how to write and register a custom symbolic function for call_function FX node.
  5. `get_attr`: Indicates an attribute access within the current module. Maps to an ONNX graph initializer.
  6. `output`: Represents the module's output. Maps to an ONNX graph output.

For a granular understanding of how each node type is transformed, refer to the implementation details in `FxOnnxInterpreter`.
z.Transforming FX node {node_repr} to ONNX node.fx_node_to_onnxFXE0010zfx-passrI   a_  This diagnostic tracks the FX passes executed during the ONNX export process prior
to converting from FX IR (Intermediate Representation) to ONNX IR.

Under the scope of ONNX export, an FX pass refers to a specific transformation applied to the FX GraphModule.
The primary aim of these passes is to streamline the graph into a format that aligns more with the ONNX IR.
Moreover, these passes work to substitute unsupported FX IR features with those recognized and endorsed by
ONNX IR. Common transformations include, but aren't limited to, decomposition, functionalization and
type promotion.

For those who are interested in a comprehensive log detailing the modifications made during these passes,
there are a couple of options:

- Set DiagnosticOptions.verbosity_level to logging.DEBUG.
- Activate the environment variable TORCH_LOGS='onnx_diagnostics'.

However, it's noteworthy that by default, such detailed logging is turned off. The primary reason being
its considerable impact on performance.

For an in-depth understanding of each specific pass, please refer to the directory: torch/onnx/_internal/fx/passes.
zRunning {pass_name} pass.fx_passFXE0011z&no-symbolic-function-for-call-functionrP   zNCannot find symbolic function to convert the "call_function" FX node to ONNX. a  This error occurs when the ONNX converter is unable to find a corresponding symbolic function
to convert a "call_function" node in the input graph to its equivalence in ONNX. The "call_function"
node represents a normalized function call in PyTorch, such as "torch.aten.ops.add".

To resolve this error, you can try one of the following:

- If exists, apply the auto-fix suggested by the diagnostic. TODO: this part is not available yet.
- Rewrite the model using only supported PyTorch operators or functions.
- Follow this [guide](https://pytorch.org/tutorials/beginner/onnx/onnx_registry_tutorial.html#overview) to write and
  register a custom symbolic function for the unsupported call_function FX node.
zKNo symbolic function to convert the "call_function" node {target} to ONNX. &no_symbolic_function_for_call_functionFXE0012zunsupported-fx-node-analysisr[   a  This error indicates that an FX graph contains one or more unsupported nodes. The error message
is typically accompanied by a list of the unsupported nodes found during analysis.

To resolve this error, you can try resolving each individual unsupported node error by following
the suggestions by its diagnostic. Typically, options include:

- If exists, apply the auto-fix suggested by the diagnostic. TODO: this part is not available yet.
- Rewrite the model using only supported PyTorch operators or functions.
- Follow this [guide](https://pytorch.org/docs/stable/onnx.html#onnx-script-functions) to write and
  register a custom symbolic function for the unsupported call_function FX node.
z3Unsupported FX nodes: {node_op_to_target_mapping}. unsupported_fx_node_analysisFXE0013zop-level-debuggingrb   a  This warning message indicates that during op level debugging, certain symbolic functions
have failed to match the results of torch ops when using real tensors generated from fake
tensors. It is important to note that the symbolic functions may not necessarily be
incorrect, as the validation process is non-deterministic and should only be used as a
reference.

There are two categories of warnings that can be triggered:

1. Non-validated operators:
  If the warnings are caused by the following errors, they can be disregarded by users,
  as these errors occur due to the non-deterministic nature of the validation. However,
  it is important to be aware that the operators have not been validated.

  - IndexError: Unsupported input arguments of randomized dimensions/indices(INT64).
  - RuntimeError: Unsupported input arguments for torch ops are generated.
  - ValueError: Arguments/keyword arguments do not match the signature of the symbolic function.

2. Potentially wrong torchlib operators:
  If the warnings are triggered by the following error, users should be aware that the symbolic functions
  may be incorrect in dispatching or implementation. In such cases, it is recommended to report
  the issue to the PyTorch-ONNX team, or create/register a custom symbolic function to replace the default one.

  - AssertionError: The symbolic function is potentially wrong as the results do not match the results of torch ops.
  - TypeError: The symbolic function is potentially wrong as the opschema doesn't match inputs.
zRFX node: {node} and its onnx function: {symbolic_fn} fails on op level validation.op_level_debuggingFXE0014z'find-opschema-matched-symbolic-functionrj   zFind the OnnxFunction that matches the input dtypes by comparing them with their opschemas. A warning will be issued if the matched OnnxFunction is not an exact match.a  When an ATen/Custom operator is registered and needs to be dispatched to an OnnxFunction, the input/attribute
dtypes of the ATen/Custom operator are compared with the input/attribute dtypes of the OnnxFunction opschemas
to find a match. However, if a perfect/exact match is not found, the dispatcher will attempt to find
the nearest match with the highest number of input/attribute dtypes matching the OnnxFunction opschemas, while
issuing a warning.

There are two types of level that can be triggered in this rule:

1. NOTE: A perfect match is found, and no warning is issued.
2. WARNING: The matched OnnxFunction is not a perfect/exact match.

Here are some suggestions based on the WARNING situation:

1. If there are NO errors or mismatches in the results, it is safe to disregard this warning,
  as the definition of OnnxFunction schema is usually more stringent.
2. If there are errors or mismatches in the results, it is recommended to:
  (a) Enable op_level_debugging to determine if the OnnxFunction might be incorrect.
  (b) Report the issue to the PyTorch-ONNX team.
  (c) Create/register a custom symbolic function to replace the default one.
zHThe OnnxFunction: {symbolic_fn} is the nearest match of the node {node}.'find_opschema_matched_symbolic_functionFXE0015zfx-node-insert-type-promotionrp   aV  This diagnostic monitors the node-level type promotion insertion process. In PyTorch, there is an automatic process called implicit type promotion,
where the input types of an operator are promoted to a common type. The determination of the common type is based on the type promotion rule specific to each operator.
To learn more about PyTorch's type promotion rules, refer to the [elementwise_dtypes doc](https://github.com/pytorch/pytorch/blob/f044613f78df713fb57f70c608483c9f10ad332e/torch/_prims_common/__init__.py#L1252-L1335)
and [torch._refs ops](https://github.com/pytorch/pytorch/blob/a475ea4542dfe961c9d097e33ab5041f61c8c17f/torch/_refs/__init__.py#L484).

However, implicit type promotion is not supported in ONNX. Therefore, to replicate the PyTorch behavior, we need to explicitly insert cast nodes.
This diagnostic tracks the process of node-level type promotion insertion.

The type promotion rules used by this process can be found in `torch/onnx/_internal/fx/passes/type_promotion.py.`
To update or add new type promotion rules, please refer to the [Note: Update type promotion rule] section.
z6Performing explicit type promotion for node {target}. fx_node_insert_type_promotionFXE0016z(find-operator-overloads-in-onnx-registryru   a/  This rule involves finding the list of OnnxFunction for the PyTorch operator overload in the ONNX registry. If the operator overload is not supported but its default overload is, a warning will be issued. If both the operator overload and its default overload are not supported, an error will be issued.a  The operator overload name serves the purpose of verifying whether a PyTorch operator is registered in the ONNX registry.
If it's not found, the dispatcher takes a fallback approach and tries to locate the default overload of the PyTorch
operator in the registry. If even the default overload is absent, it signifies that the operator is officially unsupported.

There are three types of level that can be triggered in this rule:

1. NOTE: The op overload is supported.
2. WARNING: The op overload is not supported, but it's default overload is supported.
3. ERROR: The op overload is not supported, and it's default overload is also not supported.

Here are some suggestions based on the WARNING situation:

1. If there are NO errors or mismatches in the results, it is safe to disregard this warning.
2. If there are errors or mismatches in the results, it is recommended to:
  (a) Enable op_level_debugging to determine if the OnnxFunction might be incorrect.
  (b) Report the unsupported overload to the PyTorch-ONNX team.
  (c) Create/register a custom symbolic function to replace the default one.

Here are some suggestions based on the ERROR situation:

1. Report the unsupported operator to the PyTorch-ONNX team.
2. Create/register a custom symbolic function to replace the default one.
z>Checking if the FX node: {node} is supported in onnx registry.(find_operator_overloads_in_onnx_registryr"   )!r   r   r   dataclassesfieldr   
from_sarifr   __annotations__r$   r   r)   r   r1   r   r8   r   r?   r   rH   r   rO   r   rZ   r   ra   r   ri   r   ro   r   rt   r   r"   r   r   rz   rz   <  s   HYHYHY9.99 
;&,.U%V W !^%
   !F $
 !-2B?
$ 'I%'E * 0GX{GXGX9.99 
:s& t y%
   !Y $
 !-2B?!
( +H$&D . `K\;K\K\;0;; 
<u& v {%
   !Z $
 !-2B?!
( +L&(H . bWhWbWhWh@5@@ 
CK& L !d%
   !h $
 !-2B?!
( +X-/T . 8'8{'8'8))) 
*E& F !Q%
  S $
 !-2B?!
( +(n . 2%6[%6%6((( 
)&,.V%WD !@%
  P $
 !-2B?
$ '&O] * 1({((""" 
!q& r !U% %.8S/T#U -2B?
  #GW & ^QbQ\QbQb=2== 
@k& m !r%
  m $
 !-2B?!
( +R*,N . X?P{?P?P5*55 
6[& \ !c%
  U $
 !-2B?!
( +@ "< . H,=K,=,=,!,, 
,Q& R !u%
  t $
 !-2B?!
( +-) . >TeT_TeTe?4?? 
A  D& F !z%
  j $
 !-2B?!
( +U+-Q . p@Q@Q@Q5*55 
7s& t !C%
  X $
 !-2B?!
( +A!#= . `UfU`UfUf?4?? 
Be& N !J%
  ` $
 !-2B?!
( +V,.R . Rr   rz   )r   r   typingr    torch.onnx._internal.diagnosticsr   r!   r   r$   r)   r1   r8   r?   rH   rO   rZ   ra   ri   ro   rt   	dataclassRuleCollectionrz   rulesr"   r   r   <module>r      s2     3AUZZ A(AUZZ A(
uzz 
<
EJJ 
DGUZZ G(EEJJ E(Eejj E(? ?(
 
8T

 T(T5:: T(? ?(;5:: ;( |R$$ |R |R~	 	r   