§
    1�Åj\?  ã                  óD  — d dl mZ d„ Z e¦   «          [g d¢Zd dlZd dlZd dlmZmZ d dlm	Z	 d dl
mZ d dlmZmZmZ d d	lmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3 d d
l4m5Z5m6Z6 d dl7m8Z8m9Z9m:Z: d dl;Z<d dlm=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZG ejH        rd dlImJZJ 	 e<jK         L                    d¦  «        ZMnH# e<jK        jN        $ r6 	 e<jK         L                    d¦  «        ZMn# e<jK        jN        $ r dZMY nw xY wY nw xY wed         eOz  ZPdZQdGd„ZRdHd„ZSdId„ZT	 dJdKd"„ZU	 	 dLdMd(„ZV	 dJdNd*„ZWeQfdOd.„ZXeQfdPd/„ZY	 dJd0d#dd1d0d2œdQd;„ZZ	 dJdRd<„Z[eVZ\eXZ]eZZ^dSd?„Z_dTdA„Z`dUdC„ZadVdF„Zbe_e"_c        e`e_c        eae_c        dS )Wé    )Úannotationsc            	     ó  — dd l } | j                             | j                             | j                             | j                             t          ¦  «        | j        d¦  «        ¦  «        x}¦  «        r | j        |¦  «         d S d S )Nr   z	onnx.libs)	ÚosÚpathÚisdirÚabspathÚjoinÚdirnameÚ__file__ÚpardirÚadd_dll_directory)r   Úlibs_dirs     ú>C:\Projects\Historical\venv\Lib\site-packages\onnx/__init__.pyÚ_delvewheel_patch_1_13_0r   	   s|   € Ø€I€I€IØ	„w‡}‚} ¤§¢°´·²¸b¼g¿oºoÍhÑ>WÔ>WÐY[ÔYbÐdoÑ1pÔ1pÑ!qÔ!qÐq�XÑrÔrð 'ØˆÔ˜XÑ&Ô&Ð&Ð&Ð&ð'ð 'ó    )=ÚONNX_MLÚ
IR_VERSIONÚIR_VERSION_2017_10_10ÚIR_VERSION_2017_10_30ÚIR_VERSION_2017_11_3ÚIR_VERSION_2019_1_22ÚIR_VERSION_2019_3_18ÚIR_VERSION_2019_9_19ÚIR_VERSION_2020_5_8ÚIR_VERSION_2021_7_30ÚIR_VERSION_2023_5_5ÚIR_VERSION_2024_3_25ÚEXPERIMENTALÚSTABLEÚcheckerÚcomposeÚdefsÚ	gen_protoÚhelperÚnumpy_helperÚparserÚprinterÚshape_inferenceÚutilsÚversion_converterÚAttributeProtoÚDeviceConfigurationProtoÚFunctionProtoÚ
GraphProtoÚIntIntListEntryProtoÚMapProtoÚ
ModelProtoÚNodeDeviceConfigurationProtoÚ	NodeProtoÚOperatorProtoÚOperatorSetIdProtoÚOperatorSetProtoÚOperatorStatusÚOptionalProtoÚSequenceProtoÚSimpleShardedDimProtoÚShardedDimProtoÚShardingSpecProtoÚSparseTensorProtoÚStringStringEntryProtoÚTensorAnnotationÚTensorProtoÚTensorShapeProtoÚTrainingInfoProtoÚ	TypeProtoÚValueInfoProtoÚVersionÚconvert_model_to_external_dataÚload_external_data_for_modelÚload_model_from_stringÚ
load_modelÚload_tensor_from_stringÚload_tensorÚ
save_modelÚsave_tensorÚwrite_external_data_tensorsN)ÚIOÚLiteral)Úserialization)r   )rG   rN   rF   )#r+   r,   r   r-   r.   r/   r   r   r   r   r   r   r   r   r   r   r   r1   r2   r3   r5   r7   r   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   )r4   r6   )r0   r8   r9   )r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   )ÚSequenceÚonnxzonnx-weeklyÚunknown)ÚprotobufÚ	textprotoÚonnxtxtÚjsonrU   ÚfúIO[bytes] | str | os.PathLikeÚreturnÚbytesc                óf  — t          | d¦  «        rOt          t          j        d| ¦  «        j        ¦  «        r(t          j        d| ¦  «                             ¦   «         }nQt          j        d| ¦  «        } t          | d¦  «        5 }|                     ¦   «         }d d d ¦  «         n# 1 swxY w Y   |S )NÚreadú	IO[bytes]ústr | os.PathLikeÚrb)ÚhasattrÚcallableÚtypingÚcastr^   Úopen)rY   ÚcontentÚreadables      r   Ú_load_bytesri   ¯   sÕ   € Ýˆq�&ÑÔð &�h¥v¤{°;ÀÑ'BÔ'BÔ'GÑHÔHð &Ý”+˜k¨1Ñ-Ô-×2Ò2Ñ4Ô4ˆˆåŒKÐ+¨QÑ/Ô/ˆÝ�!�T‰]Œ]ð 	&˜hØ—m’m‘o”oˆGð	&ð 	&ð 	&ñ 	&ô 	&ð 	&ð 	&ð 	&ð 	&ð 	&ð 	&øøøð 	&ð 	&ð 	&ð 	&à€Ns   ÂB&Â&B*Â-B*rg   ÚNonec                ón  — t          |d¦  «        rQt          t          j        d|¦  «        j        ¦  «        r*t          j        d|¦  «                             | ¦  «         d S t          j        d|¦  «        }t          |d¦  «        5 }|                     | ¦  «         d d d ¦  «         d S # 1 swxY w Y   d S )NÚwriter_   r`   Úwb)rb   rc   rd   re   rl   rf   )rg   rY   Úwritables      r   Ú_save_bytesro   ¹   së   € Ýˆq�'ÑÔð $�x­¬°KÀÑ(CÔ(CÔ(IÑJÔJð $ÝŒ�K Ñ#Ô#×)Ò)¨'Ñ2Ô2Ð2Ð2Ð2åŒKÐ+¨QÑ/Ô/ˆÝ�!�T‰]Œ]ð 	$˜hØ�NŠN˜7Ñ#Ô#Ð#ð	$ð 	$ð 	$ñ 	$ô 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$ð 	$øøøð 	$ð 	$ð 	$ð 	$ð 	$ð 	$s   ÂB*Â*B.Â1B.ú$IO[bytes] | str | os.PathLike | Noneú
str | Nonec                óö   — t          | t          t          j        f¦  «        rt          j                             | ¦  «        S t          | d¦  «        r(| €J ‚t          j                             | j        ¦  «        S d S )NÚname)Ú
isinstanceÚstrr   ÚPathLiker   r   rb   rs   )rY   s    r   Ú_get_file_pathrw   Â   se   € Ý�!•c�2œ;Ð'Ñ(Ô(ð "ÝŒw�Š˜qÑ!Ô!Ð!Ýˆq�&ÑÔð 'Øˆ}ˆ}ˆ}ÝŒw�Š˜qœvÑ&Ô&Ð&Øˆ4r   Úfmtú_SupportedFormat | Noneú$str | os.PathLike | IO[bytes] | Noneúserialization.ProtoSerializerc                ó@  — | �t           j                             | ¦  «        S t          |¦  «        x}�At          j                             |¦  «        \  }}t           j                             |¦  «        } | pt          } | €J ‚t           j                             | ¦  «        S )zQGet the serializer for the given path and format from the serialization registry.)	rQ   ÚregistryÚgetrw   r   r   ÚsplitextÚget_format_from_file_extensionÚ_DEFAULT_FORMAT)rx   rY   Ú	file_pathÚ_Úexts        r   Ú_get_serializerr…   Ë   sŽ   € ð
 €ÝÔ%×)Ò)¨#Ñ.Ô.Ð.å# AÑ&Ô&Ð&ˆ	Ð3Ý”×!Ò! )Ñ,Ô,‰ˆˆ3ÝÔ$×CÒCÀCÑHÔHˆð Ð
 •€CØˆ?ˆ?ˆ?åÔ!×%Ò% cÑ*Ô*Ð*r   TÚformatÚload_external_dataÚboolr1   c                ó  — t          || ¦  «                             t          | ¦  «        t          ¦   «         ¦  «        }|r@t	          | ¦  «        }|r/t
          j                             |¦  «        }t          ||¦  «         |S )a  Loads a serialized ModelProto into memory.

    Args:
        f: can be a file-like object (has "read" function) or a string/PathLike containing a file name
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.
        load_external_data: Whether to load the external data.
            Set to True if the data is under the same directory of the model.
            If not, users need to call :func:`load_external_data_for_model`
            with directory to load external data from.

    Returns:
        Loaded in-memory ModelProto.
    )	r…   Údeserialize_protori   r1   rw   r   r   r
   rG   )rY   r†   r‡   ÚmodelÚmodel_filepathÚbase_dirs         r   rI   rI   Þ   sr   € õ* ˜F AÑ&Ô&×8Ò8½ÀQ¹¼ÍÉÌÑVÔV€Eàð :Ý'¨Ñ*Ô*ˆØð 	:Ý”w—’ ~Ñ6Ô6ˆHÝ(¨°Ñ9Ô9Ð9à€Lr   r@   c                ó|   — t          || ¦  «                             t          | ¦  «        t          ¦   «         ¦  «        S )a  Loads a serialized TensorProto into memory.

    Args:
        f: can be a file-like object (has "read" function) or a string/PathLike containing a file name
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.

    Returns:
        Loaded in-memory TensorProto.
    )r…   rŠ   ri   r@   )rY   r†   s     r   rK   rK   þ   s.   € õ  ˜6 1Ñ%Ô%×7Ò7½ÀA¹¼ÍÉÌÑVÔVÐVr   Úsúbytes | strÚ_SupportedFormatc                ó`   — t          |¦  «                             | t          ¦   «         ¦  «        S )aì  Loads a binary string (bytes) that contains serialized ModelProto.

    Args:
        s: a string, which contains serialized ModelProto
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.

    Returns:
        Loaded in-memory ModelProto.
    )r…   rŠ   r1   ©r�   r†   s     r   rH   rH     s&   € õ  ˜6Ñ"Ô"×4Ò4°Q½
¹¼ÑEÔEÐEr   c                ó`   — t          |¦  «                             | t          ¦   «         ¦  «        S )aï  Loads a binary string (bytes) that contains serialized TensorProto.

    Args:
        s: a string, which contains serialized TensorProto
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.

    Returns:
        Loaded in-memory TensorProto.
    )r…   rŠ   r@   r“   s     r   rJ   rJ   $  s&   € õ  ˜6Ñ"Ô"×4Ò4°Q½¹¼ÑFÔFÐFr   Fi   )Úsave_as_external_dataÚall_tensors_to_one_fileÚlocationÚsize_thresholdÚconvert_attributeÚprotoúModelProto | bytesr•   r–   r—   r˜   Úintr™   c               ó¨  — t          | t          ¦  «        r4t          t          ¦  «                             | t          ¦   «         ¦  «        } |rt          | ||||¦  «         t          |¦  «        }|�/t          j	         
                    |¦  «        }	t          | |	¦  «        } t          ||¦  «                             | ¦  «        }
t          |
|¦  «         dS )a}  Saves the ModelProto to the specified path and optionally, serialize tensors with raw data as external data before saving.

    Args:
        proto: should be a in-memory ModelProto
        f: can be a file-like object (has "write" function) or a string containing
        a file name or a pathlike object
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.
        save_as_external_data: If true, save tensors to external file(s).
        all_tensors_to_one_file: Effective only if save_as_external_data is True.
            If true, save all tensors to one external file specified by location.
            If false, save each tensor to a file named with the tensor name.
        location: Effective only if save_as_external_data is true.
            Specify the external file that all tensors to save to.
            Path is relative to the model path.
            If not specified, will use the model name.
        size_threshold: Effective only if save_as_external_data is True.
            Threshold for size of data. Only when tensor's data is >= the size_threshold it will be converted
            to external data. To convert every tensor with raw data to external data set size_threshold=0.
        convert_attribute: Effective only if save_as_external_data is True.
            If true, convert all tensors to external data
            If false, convert only non-attribute tensors to external data
    N)rt   r\   r…   r�   rŠ   r1   rF   rw   r   r   r
   rN   Úserialize_protoro   )rš   rY   r†   r•   r–   r—   r˜   r™   rŒ   ÚbasepathÚ
serializeds              r   rL   rL   7  sÊ   € õH �%�ÑÔð XÝ¥Ñ0Ô0×BÒBÀ5Í*É,Ì,ÑWÔWˆàð 
Ý&ØÐ*¨H°nÐFWñ	
ô 	
ð 	
õ $ AÑ&Ô&€NØÐ!Ý”7—?’? >Ñ2Ô2ˆÝ+¨E°8Ñ<Ô<ˆå  ¨Ñ8Ô8×HÒHÈÑOÔO€JÝ�
˜AÑÔÐÐÐr   c                ól   — t          ||¦  «                             | ¦  «        }t          ||¦  «         dS )a  Saves the TensorProto to the specified path.

    Args:
        proto: should be a in-memory TensorProto
        f: can be a file-like object (has "write" function) or a string
        containing a file name or a pathlike object.
        format: The serialization format. When it is not specified, it is inferred
            from the file extension when ``f`` is a path. If not specified _and_
            ``f`` is not a path, 'protobuf' is used. The encoding is assumed to
            be "utf-8" when the format is a text format.
    N)r…   rž   ro   )rš   rY   r†   r    s       r   rM   rM   l  s7   € õ  ! ¨Ñ+Ô+×;Ò;¸EÑBÔB€JÝ�
˜AÑÔÐÐÐr   Úselfru   c           	     ó\  — | j         rd| j         › d�}nd}| j        rd| j        › d�}nd}| j        rd| j        › d�}nd}| j        rd| j        ›�}nd}| j        rdt          | j        ¦  «        › d�}nd}| j        rd	t          | j        ¦  «        › �}nd}d
| j        › |› |› |› |› |› |› d�	S )Nú
, domain='ú'Ú z, producer_name='z, producer_version='z, graph=z, functions=<z functions>ú, opset_import=zModelProto(ir_version=ú))	ÚdomainÚproducer_nameÚproducer_versionÚgraphÚ	functionsÚlenÚopset_importÚ_operator_set_protos_reprÚ
ir_version)r¢   r©   rª   r«   r¬   r­   r¯   s          r   Ú_model_proto_reprr²   †  s  € Ø„{ð Ø,˜dœkÐ,Ð,Ð,ˆˆàˆØÔð ØA¨DÔ,>ÐAÐAÐAˆˆàˆØÔð ØJ°$Ô2GÐJÐJÐJÐÐàÐØ„zð Ø)˜4œ:Ð)Ð)ˆˆàˆØ„~ð ØD¥C¨¬Ñ$7Ô$7ÐDÐDÐDˆ	ˆ	àˆ	ØÔð ØWÕ)BÀ4ÔCTÑ)UÔ)UÐWÐWˆˆàˆØ D¤OÐ°\ÐÀ6ÐÈ=ÐÐZjÐÐlqÐÐs|ÐÐÐÐr   r.   c           	     ó‚  — | j         rdt          | j         ¦  «        › d�}nd}| j        rdt          | j        ¦  «        › d�}nd}| j        rdt          | j        ¦  «        › d�}nd}| j        rdt          | j        ¦  «        › d	�}nd}| j        rd
t          | j        ¦  «        › d�}nd}d| j        › d|› |› |› |› |› d�	S )Nz, initializer=<z initializers>r¦   ú, node=<ú nodes>z, value_info=<z value_info>ú	, input=<ú inputs>ú
, output=<ú	 outputs>zGraphProto('r¥   r¨   )Úinitializerr®   ÚnodeÚ
value_infoÚinputÚoutputrs   )r¢   rº   r»   r¼   r½   r¾   s         r   Ú_graph_proto_reprr¿   ¢  s  € ØÔð ØM­¨DÔ,<Ñ(=Ô(=ÐMÐMÐMˆˆàˆØ„yð Ø1�#˜dœi™.œ.Ð1Ð1Ð1ˆˆàˆØ„ð ØH¥c¨$¬/Ñ&:Ô&:ÐHÐHÐHˆ
ˆ
àˆ
Ø„zð Ø5�C ¤
™OœOÐ5Ð5Ð5ˆˆàˆØ„{ð Ø9�c $¤+Ñ.Ô.Ð9Ð9Ð9ˆˆàˆØU˜$œ)ÐUÐU eÐU¨VÐU°[ÐUÀ$ÐUÈ
ÐUÐUÐUÐUr   r-   c                óÀ  — | j         rd| j         › d�}nd}| j        rd| j        › d�}nd}| j        rdt          | j        ¦  «        › d�}nd}| j        rd| j        › �}nd}| j        rdt          | j        ¦  «        › �}nd}| j        rd	t          | j        ¦  «        › d
�}nd}| j        rdt          | j        ¦  «        › d�}nd}d| j	        › d|› |› |› |› |› |› |› d�S )Nr¤   r¥   r¦   z, overload='r´   rµ   z, attribute=r§   r¶   r·   r¸   r¹   zFunctionProto('r¨   )
r©   Úoverloadr»   r®   Ú	attributer¯   r°   r½   r¾   rs   )r¢   r©   rÁ   r»   rÂ   r¯   r½   r¾   s           r   Ú_function_proto_reprrÃ   º  sL  € Ø„{ð Ø,˜dœkÐ,Ð,Ð,ˆˆàˆØ„}ð Ø2 $¤-Ð2Ð2Ð2ˆˆàˆØ„yð Ø1�#˜dœi™.œ.Ð1Ð1Ð1ˆˆàˆØ„~ð Ø3 4¤>Ð3Ð3ˆ	ˆ	àˆ	ØÔð ØWÕ)BÀ4ÔCTÑ)UÔ)UÐWÐWˆˆàˆØ„zð Ø5�C ¤
™OœOÐ5Ð5Ð5ˆˆàˆØ„{ð Ø9�c $¤+Ñ.Ô.Ð9Ð9Ð9ˆˆàˆØj˜TœYÐjÐj¨Ðj°Ðj¸<ÐjÈÐjÐPVÐjÐXaÐjÐcgÐjÐjÐjÐjr   ÚprotosúSequence[OperatorSetIdProto]c                ó8   — d„ | D ¦   «         }t          |¦  «        S )Nc                ó(   — i | ]}|j         |j        “ŒS © )r©   Úversion)Ú.0rš   s     r   ú
<dictcomp>z-_operator_set_protos_repr.<locals>.<dictcomp>Û  s   € ÐEÐEÐE°U�U”\ 5¤=ÐEÐEÐEr   )Úrepr)rÄ   Úopset_importss     r   r°   r°   Ú  s#   € ØEÐE¸fÐEÑEÔE€MÝ�ÑÔÐr   )rY   rZ   r[   r\   )rg   r\   rY   rZ   r[   rj   )rY   rp   r[   rq   )N)rx   ry   rY   rz   r[   r{   )NT)rY   rZ   r†   ry   r‡   rˆ   r[   r1   )rY   rZ   r†   ry   r[   r@   )r�   r�   r†   r‘   r[   r1   )r�   r\   r†   r‘   r[   r@   )rš   r›   rY   rZ   r†   ry   r•   rˆ   r–   rˆ   r—   rq   r˜   rœ   r™   rˆ   r[   rj   )rš   r@   rY   rZ   r†   ry   r[   rj   )r¢   r1   r[   ru   )r¢   r.   r[   ru   )r¢   r-   r[   ru   )rÄ   rÅ   r[   ru   )dÚ
__future__r   r   Ú__all__r   rd   rO   rP   rS   rQ   Úonnx.onnx_cpp2py_exportr   Úonnx.external_data_helperrG   rN   rF   Úonnx.onnx_pbr+   r,   r   r-   r.   r/   r   r   r   r   r   r   r   r   r   r   r   r1   r2   r3   r5   r7   r   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   Úonnx.onnx_operators_pbr4   r6   Úonnx.onnx_data_pbr0   r8   r9   Úimportlib.metadataÚ	importlibr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   ÚTYPE_CHECKINGÚcollections.abcrR   ÚmetadatarÉ   Ú__version__ÚPackageNotFoundErrorru   r‘   r�   ri   ro   rw   r…   rI   rK   rH   rJ   rL   rM   ÚloadÚload_from_stringÚsaver²   r¿   rÃ   r°   Ú__repr__rÈ   r   r   ú<module>rà      s›  ðð
 #Ð "Ð "Ð "Ð "Ð "ð'ð 'ð 'ð Ð Ñ Ô Ð ØðBð Bð B€ðJ 
€	€	€	Ø €€€Ø Ð Ð Ð Ð Ð Ð Ð ð Ð Ð Ð Ð Ð Ø +Ð +Ð +Ð +Ð +Ð +ðð ð ð ð ð ð ð ð ð ð
$ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ð $ðJ CÐ BÐ BÐ BÐ BÐ BÐ BÐ BØ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DÐ DØ Ð Ð Ð ðð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð ð 
Ôð )Ø(Ð(Ð(Ð(Ð(Ð(ð ØÔ$×,Ò,¨VÑ4Ô4€K€KøØÔÔ.ð  ð  ð  ð ØÔ(×0Ò0°Ñ?Ô?ˆˆøØÔÔ2ð  ð  ð  Øˆˆˆð øøøøøð øøøð ÐEÔFÈÑLÐ à€ðð ð ð ð$ð $ð $ð $ðð ð ð ð MQð+ð +ð +ð +ð +ð* '+Ø#ðð ð ð ð ðD '+ðWð Wð Wð Wð Wð*  /ðFð Fð Fð Fð Fð*  /ðGð Gð Gð Gð Gð, '+ð2ð
 #(Ø$(ØØØ#ð2ð 2ð 2ð 2ð 2ð 2ðp '+ðð ð ð ð ð* €Ø)Ð Ø€ð@ð @ð @ð @ð8Vð Vð Vð Vð0kð kð kð kð@ð ð ð ð (€
Ô Ø'€
Ô Ø-€Ô Ð Ð s6   ÃC" Ã"D'Ã2DÄD'ÄD!ÄD'Ä D!Ä!D'Ä&D'