
    ¯wg                        d Z ddlmZ ddlZddlmZ erddlZddlZddlZ	 ej                  dd       G d d             Z ej                  dd       G d	 d
             Zy)z8Module for handling ATen to ONNX functions registration.    )annotationsN)TYPE_CHECKINGT)frozeneqc                  B    e Zd ZU dZded<   ded<   dZded<   dZded	<   y
)ONNXFunctiona_  A wrapper of onnx-script function.

    op_full_name: The qualified name of the function. In the form of '<namespace>::<op_name>.<overload>'.
    onnx_function: The onnx-script function from torchlib.
    is_custom: Whether the function is a custom function.
    is_complex: Whether the function is a function that handles complex valued inputs.

    z7onnxscript.OnnxFunction | onnxscript.TracedOnnxFunctiononnx_functionstrop_full_nameFbool	is_custom
is_complexN)__name__
__module____qualname____doc____annotations__r   r        i/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/torch/onnx/_internal/fx/registration.pyr   r      s*     KJItJr   r   c                      e Zd ZU dZded<   ded<   ded<   e	 d	 	 	 	 	 	 	 dd       Zedd       Zedd	       Ze	 	 	 	 dd
       Z	ddZ
y)OpNamezAA class representing an operator name in internal ONNX converter.r
   	namespaceop_nameoverloadNc                (    ||dk(  rd} | |||      S )N defaultr   )clsr   r   r   s       r   from_name_partszOpName.from_name_parts-   s$     x2~ H9gx00r   c                x    |j                  d      \  }}|j                  dd      ^}}|r|d   nd} | |||      S )z4When the name is <namespace>::<op_name>[.<overload>]::.   r   r   )split)r   qualified_namer   opname_overloadr   r   s         r   from_qualified_namezOpName.from_qualified_name7   sL     &4%9%9$%?"	?,223:("*8A;	9gx00r   c                @    | j                  |j                               S N)r(   name)r   op_overloads     r   from_op_overloadzOpName.from_op_overload?   s    &&{'7'7'9::r   c                `    |j                   }|j                  }| j                  |dz   |z         S )a  From a builtin function, e.g. operator.add, math.ceil, etc, get the OpName.

        FX graph uses built-in functions to caculate sympy expression. This function
        is used to get the OpName from a builtin function.

        Args:
            builtin_function (types.BuiltinFunctionType): operator.add, math.ceil, etc.

        Returns:
            OpName: _description_
        r"   )r   r   r(   )r   builtin_functionopmodules       r   from_builtin_functionzOpName.from_builtin_functionC   s4     &&!,,&&v}r'9::r   c                R    | j                    d| j                   d| j                   S )Nr"   r#   )r   r   r   )selfs    r   r&   zOpName.qualified_nameV   s&    ..!DLL>4==/BBr   r*   )r   r
   r   r
   r   z
str | Nonereturnr   )r&   r
   r5   r   )r,   ztorch._ops.OpOverloadr5   r   )r/   ztypes.BuiltinFunctionTyper5   r   )r5   r
   )r   r   r   r   r   classmethodr    r(   r-   r2   r&   r   r   r   r   r   %   s    KNLMBF11&)15?1	1 1 1 1 ; ; ;8;	; ;$Cr   r   )r   
__future__r   dataclassestypingr   types
onnxscript
torch._opstorch	dataclassr   r   r   r   r   <module>r?      sr    > "     dt,  -  dt,1C 1C -1Cr   