
    Ph                        d Z ddlmZ ddlZddlZddlmZmZmZ ddl	Z
ddlmZ er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)OptionalTYPE_CHECKINGUnion)	_beartypeT)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.

    zAUnion['onnxscript.OnnxFunction', 'onnxscript.TracedOnnxFunction']onnx_functionstrop_full_nameFbool	is_custom
is_complexN)__name__
__module____qualname____doc____annotations__r   r        oC:\Users\daisl\Desktop\realtime-object-detection\venv\Lib\site-packages\torch/onnx/_internal/fx/registration.pyr   r      s*     UTItJr   r   c                  0   e Zd ZU dZded<   ded<   ded<   eej                  	 d	 	 	 	 	 	 	 dd              Zeej                  dd              Z	eej                  dd	              Z
eej                  	 	 	 	 dd
              Zej                  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_name:   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_overloadC   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_functionH   s4      &&!,,&&v}r'9::r   c                R    | j                    d| j                   d| j                   S )Nr%   r&   )r   r   r   )selfs    r   r)   zOpName.qualified_name\   s&    ..!DLL>4==/BBr   r-   )r   r   r   r   r   zOptional[str]returnr   )r)   r   r8   r   )r/   ztorch._ops.OpOverloadr8   r   )r2   ztypes.BuiltinFunctionTyper8   r   )r8   r   )r   r   r   r   r   classmethodr   beartyper#   r+   r0   r5   r)   r   r   r   r   r   $   s    KNLMEI
1
1&)
15B
1	
1  
1 1  1 ;  ; ;8;	;  ;$ C Cr   r   )r   
__future__r   dataclassestypestypingr   r   r   
torch._opstorchtorch.onnx._internalr   
onnxscript	dataclassr   r   r   r   r   <module>rD      sx    > "   1 1  *
  dt,  -  dt,9C 9C -9Cr   