
    h)                       S r SSKJr  / SQrSSKrSSKrSSKJrJrJ	r	  SSK
Jr  SSKrSSKJs  Jr  SSKrSSKJrJrJrJrJrJrJrJrJrJr  Sr\R<                  " 5       r\\l         S	\RB                  RE                  5       0\l#        \	" S
\S\4   S9r$SS jr%\4     SS jjr&\4SS jjr'\4     SS jjr(\4SS jjr) S     SS jjr*\4SS jjr+\4     SS jjr,  S       S S jjr-\R\                  r.g)!zDGraph utilities for checking whether an ONNX proto message is legal.    )annotations)check_attributecheck_functioncheck_graphcheck_model
check_nodecheck_sparse_tensorcheck_tensorcheck_value_infoDEFAULT_CONTEXTValidationErrorCMAXIMUM_PROTOBUFN)AnyCallableTypeVar)Message)

IR_VERSIONAttributeProtoFunctionProto
GraphProto
ModelProto	NodeProtoSparseTensorProtoTensorProtoValueInfoProtohelperi 5w FuncType.)boundc                V    [        X5      (       d  [        SUR                   S35      eg )Nz'The proto message needs to be of type '')
isinstance	TypeError__name__)proto
proto_types     F/var/www/fran/franai/venv/lib/python3.13/site-packages/onnx/checker.py_ensure_proto_typer)   ?   s2    e((5j6I6I5J!L
 	
 )    c                l    [        U [        5        [        R                  " U R	                  5       U5      $ N)r)   r   r   r   SerializeToString)
value_infoctxs     r(   r   r   F   s*     z>2j::<cBBr*   c                l    [        U [        5        [        R                  " U R	                  5       U5      $ r,   )r)   r   r   r
   r-   )tensorr/   s     r(   r
   r
   M   s&    v{+>>&224c::r*   c                l    [        U [        5        [        R                  " U R	                  5       U5      $ r,   )r)   r   r   r   r-   )attrr/   s     r(   r   r   R   s*     t^,T335s;;r*   c                l    [        U [        5        [        R                  " U R	                  5       U5      $ r,   )r)   r   r   r   r-   )noder/   s     r(   r   r   Y   s&    tY'<<..0#66r*   c                b   [        U [        5        Ucw  [        R                  " 5       n[        R
                  " [        U R                  5      S5      Ul        0 nU R                   H  nUR                  X#R                  '   M     X!l        [        R                  " U R                  5       U5        g )NT)r)   r   r   CheckerContextr   find_min_ir_version_forlistopset_import
ir_versionversiondomainopset_importsr   r-   )functionr/   function_opset_dicdomain_versions       r(   r   r   ^   s     x/
{ 77&&'
  &33N8F8N8N445 4.X//137r*   c                l    [        U [        5        [        R                  " U R	                  5       U5      $ r,   )r)   r   r   r   r-   )graphr/   s     r(   r   r   n   s&    uj)==002C88r*   c                n    [        U [        5        [        R                  " U R	                  5       U5        g r,   )r)   r   r   r	   r-   )sparser/   s     r(   r	   r	   s   s(     v01&224c:r*   c                t   [        U [        [        R                  45      (       a,  [        R
                  " [        R                  " U 5      X5        g[        U [        5      (       a  U OU R                  5       n[        R                  " U5      [        :  a  [        S5      e[        R                  " X1U5        g)a,  Check the consistency of a model. An exception is raised if the test fails.

Args:
    model: Model to check.
    full_check: If True, the function also checks for shapes that can be inferred.
    skip_opset_compatibility_check: If True, the function skips the check for
        opset compatibility.
zZThis protobuf of onnx model is too large (>2GB). Call check_model with model path instead.N)r#   strosPathLiker   check_model_pathfspathbytesr-   sys	getsizeofr   
ValueErrorr   )model
full_checkskip_opset_compatibility_checkprotobuf_strings       r(   r   r   z   s     %#r{{+,,	299U+ZX  u--E53J3J3L 	
 ==),<<l  	
o3QRr*   )r&   r   r'   ztype[Message]returnNone)r.   r   r/   C.CheckerContextrT   rU   )r1   r   r/   rV   rT   rU   )r3   r   r/   rV   rT   rU   )r5   r   r/   rV   rT   rU   r,   )r?   r   r/   zC.CheckerContext | NonerT   rU   )rC   r   r/   rV   rT   rU   )rE   r   r/   rV   rT   rU   )FF)rP   z&ModelProto | str | bytes | os.PathLikerQ   boolrR   rW   rT   rU   )/__doc__
__future__r   __all__rH   rM   typingr   r   r   google.protobuf.messager   	onnx.defsonnxonnx.onnx_cpp2py_export.checkeronnx_cpp2py_exportcheckerr   onnx.shape_inferencer   r   r   r   r   r   r   r   r   r   r   r7   r   r;   defsonnx_opset_versionr>   r   r)   r   r
   r   r   r   r   r	   r   r    r*   r(   <module>rf      s   K " 
 
 ) ) +  + +      ""$' !#TYY%A%A%C D  :Xc3h%78
 9HCC%5C	C ?N ; 3B<
</<	< 9H 7 =A88"98	8  <K 9 8G;;$4;	; +0S1SS %)S 
	S: ##r*   