
    [i                        d Z ddlmZ g dZddlZddlmZ erddlmZ  G d de	          Z
 G d	 d
e          Z G d de          Z G d de          ZdS )zONNX exporter exceptions.    )annotations)OnnxExporterWarningSymbolicValueErrorUnsupportedOperatorErrorN)TYPE_CHECKING)_Cc                      e Zd ZdZdS )r   zWarnings in the ONNX exporter.N__name__
__module____qualname____doc__     D/var/www/icac/venv/lib/python3.11/site-packages/torch/onnx/errors.pyr   r      s        ((((r   r   c                      e Zd ZdZdS )OnnxExporterErrorzSErrors raised by the ONNX exporter. This is the base class for all exporter errors.Nr
   r   r   r   r   r      s        ]]]]r   r   c                  $     e Zd ZdZd fd
Z xZS )r   z7Raised when an operator is unsupported by the exporter.namestrversionintsupported_version
int | NonereturnNonec                    |d| d| d| d}n%|                     d          r
d| d| d}nd| d}t                                          |           d S )	NzExporting the operator 'z' to ONNX opset version zB is not supported. Support for this operator was added in version z!, try exporting with this version)zaten::zprim::zquantized::z is not supportedz>ONNX export failed on an operator with unrecognized namespace zo. If you are trying to export a custom operator, make sure you registered it with the right domain and version.)
startswithsuper__init__)selfr   r   r   msg	__class__s        r   r    z!UnsupportedOperatorError.__init__!   s    (H4 H H H H$H H H C
 __@AA 
	#4 # # # # # C0QU 0 0 0  	r   )r   r   r   r   r   r   r   r   r   r   r   r   r    __classcell__r#   s   @r   r   r      sC        AA         r   r   c                  $     e Zd ZdZd	 fdZ xZS )
r   z+Errors around TorchScript values and nodes.r"   r   value_C.Valuer   r   c                   | d| d|                                  d|                                                                 d}|                                                                }|r	|d| dz  }	 |dz  }|t	          j        dd	                    d
 t          |                                                                          D                       pdz   d	z   dz   d	                    d t          |                                	                                          D                       pdz   d          z  }n# t          $ r |dz  }Y nw xY wt                                          |           d S )Nz  [Caused by the value 'z	' (type 'z;') in the TorchScript graph. The containing node has kind 'z'.] z
    (node defined in )z

zInputs:

c              3  X   K   | ]%\  }}d | d| d|                                  dV  &dS z    #z: z	  (type 'z')Ntype).0iinput_s      r   	<genexpr>z.SymbolicValueError.__init__.<locals>.<genexpr>M   ^       " " )6 LAKKKK&++--KKK" " " " " "r   z	    Emptyz	Outputs:
c              3  X   K   | ]%\  }}d | d| d|                                  dV  &dS r.   r/   )r1   r2   outputs      r   r4   z.SymbolicValueError.__init__.<locals>.<genexpr>V   r5   r   z    zv Failed to obtain its input and output for debugging. Please refer to the TorchScript graph for debugging information.)r0   nodekindsourceRangetextwrapindentjoin	enumerateinputsoutputsAttributeErrorr   r    )r!   r"   r(   messagecode_locationr#   s        r   r    zSymbolicValueError.__init__<   s    Z ZE Z ZEJJLL Z Z@E

@Q@Q@S@SZ Z Z 	
 

0022 	BAAAAAG	vGx		 " "-6uzz||7J7J7L7L-M-M" " "   ' '  #	# 		 " "-6uzz||7K7K7M7M-N-N" " "   ' '$ )  GG,  	 	 	SGGG	 	!!!!!s   8C	E EE)r"   r   r(   r)   r   r   r$   r&   s   @r   r   r   7   sC        55)" )" )" )" )" )" )" )" )" )"r   r   )r   
__future__r   __all__r;   typingr   torchr   UserWarningr   RuntimeErrorr   r   r   r   r   r   <module>rJ      s#     " " " " " "                 ) ) ) ) )+ ) ) )^ ^ ^ ^ ^ ^ ^ ^    0   6." ." ." ." ."* ." ." ." ." ."r   