§
    ù¸¸já  ã                  óÞ  — d Z ddlmZ g d¢ZddlZddlZddlmZmZm	Z	m
Z
 ddlZddlmc mZ ddlZddlmZmZmZmZmZmZmZmZmZ erddlmZ dZ ej        ¦   «         Zee_         d	ej!         "                    ¦   «         ie_#         ej$        ¦   «         Z% e
d
e	def         ¬¦  «        Z&d6d„Z'efd7d„Z(efd8d„Z)ee%fd9d „Z*ee%fd:d#„Z+de%fd;d'„Z,ee%fd<d*„Z-efd=d-„Z.	 	 	 d>d?d5„Z/ej0        Z0dS )@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ÚLEXICAL_SCOPE_CONTEXTÚValidationErrorÚCÚMAXIMUM_PROTOBUFN)ÚTYPE_CHECKINGÚAnyÚCallableÚTypeVar)	Ú
IR_VERSIONÚAttributeProtoÚFunctionProtoÚ
GraphProtoÚ
ModelProtoÚ	NodeProtoÚSparseTensorProtoÚTensorProtoÚValueInfoProto)ÚMessagel        Ú ÚFuncType.)ÚboundÚprotor   Ú
proto_typeútype[Message]ÚreturnÚNonec                óV   — t          | |¦  «        st          d|j        › d�¦  «        ‚d S )Nz'The proto message needs to be of type 'ú')Ú
isinstanceÚ	TypeErrorÚ__name__)r"   r#   s     ú\/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/onnx/checker.pyÚ_ensure_proto_typer-   B   sA   € Ý�e˜ZÑ(Ô(ð 
ÝØL°jÔ6IÐLÐLÐLñ
ô 
ð 	
ð
ð 
ó    Ú
value_infor   ÚctxúC.CheckerContextc                óz   — t          | t          ¦  «         t          j        |                      ¦   «         |¦  «        S ©N)r-   r   r   r   ÚSerializeToString)r/   r0   s     r,   r   r   I   s3   € õ �z¥>Ñ2Ô2Ð2ÝÔ˜j×:Ò:Ñ<Ô<¸cÑBÔBÐBr.   Útensorr   c                óz   — t          | t          ¦  «         t          j        |                      ¦   «         |¦  «        S r3   )r-   r   r   r
   r4   )r5   r0   s     r,   r
   r
   P   s0   € Ý�v�{Ñ+Ô+Ð+ÝŒ>˜&×2Ò2Ñ4Ô4°cÑ:Ô:Ð:r.   Úattrr   Úlexical_scope_ctxúC.LexicalScopeContextc                ó|   — t          | t          ¦  «         t          j        |                      ¦   «         ||¦  «        S r3   )r-   r   r   r   r4   )r7   r0   r8   s      r,   r   r   U   s6   € õ
 �t�^Ñ,Ô,Ð,ÝÔ˜T×3Ò3Ñ5Ô5°sÐ<MÑNÔNÐNr.   Únoder   c                ó|   — t          | t          ¦  «         t          j        |                      ¦   «         ||¦  «        S r3   )r-   r   r   r   r4   )r;   r0   r8   s      r,   r   r   ^   s5   € õ
 �t�YÑ'Ô'Ð'ÝŒ<˜×.Ò.Ñ0Ô0°#Ð7HÑIÔIÐIr.   Úfunctionr   úC.CheckerContext | Nonec                ó,  — t          | t          ¦  «         |€Tt          j        ¦   «         }t          j                             | j        d¬¦  «        |_        d„ | j        D ¦   «         |_	        t          j
        |                      ¦   «         ||¦  «         d S )NT)Úignore_unknownc                ó(   — i | ]}|j         |j        “ŒS © )ÚdomainÚversion)Ú.0Údomain_versions     r,   ú
<dictcomp>z"check_function.<locals>.<dictcomp>r   s0   € ð 
ð 
ð 
àð Ô! >Ô#9ð
ð 
ð 
r.   )r-   r   r   ÚCheckerContextÚonnxÚhelperÚfind_min_ir_version_forÚopset_importÚ
ir_versionÚopset_importsr   r4   )r=   r0   r8   s      r,   r   r   g   s›   € õ
 �x¥Ñ/Ô/Ð/Ø
€{ÝÔÑ Ô ˆÝœ×<Ò<ØÔ!°$ð =ñ 
ô 
ˆŒð
ð 
à"*Ô"7ð
ñ 
ô 
ˆÔõ Ô�X×/Ò/Ñ1Ô1°3Ð8IÑJÔJÐJÐJÐJr.   Úgraphr   c                ó|   — t          | t          ¦  «         t          j        |                      ¦   «         ||¦  «        S r3   )r-   r   r   r   r4   )rO   r0   r8   s      r,   r   r   y   s5   € õ
 �u�jÑ)Ô)Ð)ÝŒ=˜×0Ò0Ñ2Ô2°CÐ9JÑKÔKÐKr.   Úsparser   c                ó~   — t          | t          ¦  «         t          j        |                      ¦   «         |¦  «         d S r3   )r-   r   r   r	   r4   )rQ   r0   s     r,   r	   r	   ‚   s:   € õ �vÕ0Ñ1Ô1Ð1ÝÔ˜&×2Ò2Ñ4Ô4°cÑ:Ô:Ð:Ð:Ð:r.   FÚmodelú&ModelProto | str | bytes | os.PathLikeÚ
full_checkÚboolÚskip_opset_compatibility_checkÚcheck_custom_domainc                óz  — t          | t          t          j        f¦  «        r+t	          j        t          j        | ¦  «        |||¦  «         dS t          | t          ¦  «        r| n|                      ¦   «         }t          j
        |¦  «        t          k    rt          d¦  «        ‚t	          j        ||||¦  «         dS )ar  Check the consistency of a model.

    An exception will be raised if the model's ir_version is not set
    properly or is higher than checker's ir_version, or if the model
    has duplicate keys in metadata_props.

    If IR version >= 3, the model must specify opset_import.
    If IR version < 3, the model cannot have any opset_import specified.

    Args:
        model: Model to check. If model is a path, the function checks model
            path first. If the model bytes size is larger than 2GB, function
            should be called using model path.
        full_check: If True, the function also runs shape inference check.
        skip_opset_compatibility_check: If True, the function skips the check for
            opset compatibility.
        check_custom_domain: If True, the function will check all domains. Otherwise
            only check built-in domains.
    z[This protobuf of onnx model is too large (>2GiB). Call check_model with model path instead.N)r)   ÚstrÚosÚPathLiker   Úcheck_model_pathÚfspathÚbytesr4   ÚsysÚ	getsizeofr   Ú
ValueErrorr   )rS   rU   rW   rX   Úprotobuf_strings        r,   r   r   ‰   sÔ   € õ4 �%�#�rœ{Ð+Ñ,Ô,ð 
Ý	ÔÝŒI�eÑÔØØ*Øñ		
ô 	
ð 	
ð 	
ð 	
õ   ¥uÑ-Ô-ÐLˆEˆE°5×3JÒ3JÑ3LÔ3Lð 	õ
 Œ=˜Ñ)Ô)Õ,<Ò<Ð<ÝØmñô ð õ 	
ŒØØØ*Øñ		
ô 	
ð 	
ð 	
ð 	
r.   )r"   r   r#   r$   r%   r&   )r/   r   r0   r1   r%   r&   )r5   r   r0   r1   r%   r&   )r7   r   r0   r1   r8   r9   r%   r&   )r;   r   r0   r1   r8   r9   r%   r&   )r=   r   r0   r>   r8   r9   r%   r&   )rO   r   r0   r1   r8   r9   r%   r&   )rQ   r   r0   r1   r%   r&   )FFF)
rS   rT   rU   rV   rW   rV   rX   rV   r%   r&   )1Ú__doc__Ú
__future__r   Ú__all__r[   r`   Útypingr   r   r   r   Ú	onnx.defsrI   Úonnx.onnx_cpp2py_export.checkerÚonnx_cpp2py_exportÚcheckerr   Úonnx.shape_inferencer   r   r   r   r   r   r   r   r   Úgoogle.protobuf.messager   r   rH   r   rM   ÚdefsÚonnx_opset_versionrN   ÚLexicalScopeContextr   r    r-   r   r
   r   r   r   r   r	   r   r   rB   r.   r,   ú<module>rq      sÔ  ðð KÐ Jà "Ð "Ð "Ð "Ð "Ð "ðð ð €ð  
€	€	€	Ø 
€
€
€
Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8à Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø Ð Ð Ð ð
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð 
ð ð 0Ø/Ð/Ð/Ð/Ð/Ð/ð Ð ð #�!Ô"Ñ$Ô$€Ø'€Ô à!# T¤Y×%AÒ%AÑ%CÔ%CÐ D€Ô à-˜Ô-Ñ/Ô/Ð ð ˆ7�: X¨c°3¨hÔ%7Ð8Ñ8Ô8€ð
ð 
ð 
ð 
ð 9HðCð Cð Cð Cð Cð ?Nð ;ð ;ð ;ð ;ð ;ð ,Ø/DðOð Oð Oð Oð Oð ,Ø/DðJð Jð Jð Jð Jð $(Ø/DðKð Kð Kð Kð Kð( ,Ø/DðLð Lð Lð Lð Lð 8Gð;ð ;ð ;ð ;ð ;ð Ø+0Ø %ð	0
ð 0
ð 0
ð 0
ð 0
ðf Ô#€€€r.   