§
    ú¸¸jM  ã                  óÞ  — d dl mZ d dlZd dlmZ d dlmZ d dlZd dlZd dl	Zd dl
Zd dlmZmZ erd dlmZ ej                             dd¦  «        Zej                             dd¦  «        Zej                             d	d¦  «        Zej                             d
d¦  «        Zej                             dd¦  «        Z e¦   «         Z G d„ de¦  «        Zedk    r ej        ¦   «          dS dS )é    )ÚannotationsN)ÚTYPE_CHECKING)ÚTestShapeInferenceHelper)ÚAttributeProtoÚ	TypeProto)ÚSequenceé   é   é   é   é
   c                  ó0   — e Zd Zdd„Zdd	„Zd
„ Zd„ Zd„ ZdS )ÚTestFunctionInferenceÚfunction_textÚstrÚinput_typesúSequence[TypeProto]Ú
attributesúSequence[AttributeProto]Úexpected_output_typesc                ó>  — t           j                             |¦  «        }t           j                             |||¦  «        }|                      t          |¦  «        t          |¦  «        ¦  «         t          ||¦  «        D ]\  }}|                      ||¦  «         Œd S ©N)	ÚonnxÚparserÚparse_functionÚshape_inferenceÚinfer_function_output_typesÚassertEqualÚlenÚzipÚ_compare_value_infos)	Úselfr   r   r   r   ÚfunctionÚresultÚexpectedÚactuals	            úq/root/private/project/pallet_detection_v2/.venv/lib/python3.11/site-packages/onnx/test/function_inference_test.pyÚ_checkzTestFunctionInference._check   s¡   € õ ”;×-Ò-¨mÑ<Ô<ˆÝÔ%×AÒAØ�k :ñ
ô 
ˆð 	×Ò�Ð2Ñ3Ô3µS¸±[´[ÑAÔAÐAÝ #Ð$9¸6Ñ BÔ Bð 	8ð 	8ÑˆH�fØ×%Ò% h°Ñ7Ô7Ð7Ð7ð	8ð 	8ó    c                ó¢   ‡‡‡— t           j                             |¦  «        Šˆˆˆfd„}|                      t           j        j        |¦  «         d S )Nc                 óJ   •— t           j                             ‰‰‰ ¦  «         d S r   )r   r   r   )r   r#   r   s   €€€r'   Úinvoke_inferencez<TestFunctionInference._check_fails.<locals>.invoke_inference4   s/   ø€ ÝÔ ×<Ò<Ø˜+ zñô ð ð ð r)   )r   r   r   ÚassertRaisesr   ÚInferenceError)r"   r   r   r   r,   r#   s     `` @r'   Ú_check_failsz"TestFunctionInference._check_fails,   sd   øøø€ õ ”;×-Ò-¨mÑ<Ô<ˆð	ð 	ð 	ð 	ð 	ð 	ð 	ð
 	×Ò�$Ô.Ô=Ð?OÑPÔPÐPÐPÐPr)   c                óø   — d}|                       |t          t          gg t          g¦  «         |                       |t          t          gg t          g¦  «         |                      |t          t          gg ¦  «         d S )Nzª
            <opset_import: [ "" : 18 ], domain: "local">
            f (y, z) => (w) {
                x = Add(y, z)
                w = Mul(x, y)
            }
        )r(   Úfloat_type_Úint32_type_r/   ©r"   Úcodes     r'   Útest_fi_basicz#TestFunctionInference.test_fi_basic;   sl   € ðˆð 	�Š�D�;­Ð4°b½;¸-ÑHÔHÐHØ�Š�D�;­Ð4°b½;¸-ÑHÔHÐHØ×Ò˜$¥­kÐ :¸BÑ?Ô?Ð?Ð?Ð?r)   c                ó  — d}t           j                             dd¦  «        }|                      |t          g|gt
          g¦  «         t           j                             dd¦  «        }|                      |t          g|gt          g¦  «         d S )Nz©
            <opset_import: [ "" : 18 ], domain: "local">
            CastTo <dtype> (x) => (y) {
                y = Cast <to : int = @dtype> (x)
            }
        Údtyper   r   )r   ÚhelperÚmake_attributer(   r1   r2   Úfloat16_type_)r"   r4   Údtype_6Údtype_10s       r'   Útest_fi_attributez'TestFunctionInference.test_fi_attributeG   s{   € ðˆõ ”+×,Ò,¨W°aÑ8Ô8ˆØ�Š�D�;˜-¨'¨µ[°MÑBÔBÐBå”;×-Ò-¨g°rÑ:Ô:ˆØ�Š�D�;˜-¨(¨µm°_ÑEÔEÐEÐEÐEr)   c                ó€  — d}|                       |t          gg t          g¦  «         |                       |t          t          gg t          g¦  «         d}|                       |t          t          t          gg t          g¦  «         |                       |t          t          t          gg t          g¦  «         |                       |t          t          t          gg t          g¦  «         d}|                       |t          t          t          gg t          g¦  «         |                      |t          t          t          gg ¦  «         d S )Nz 
            <opset_import: [ "" : 18 ], domain: "local">
            DoReduce (x, axes) => (y) {
                y = ReduceMax (x, axes)
            }
        z¿
            <opset_import: [ "" : 18 ], domain: "local">
            Quantize (x, scale, zero_point) => (y) {
                y = QuantizeLinear (x, scale, zero_point)
            }
        z¡
            <opset_import: [ "" : 18 ], domain: "local">
            DoClip (x, min, max) => (y) {
                y = Clip (x, min, max)
            }
        )r(   r1   Úno_type_Ú
int8_type_Úuint8_type_r/   r3   s     r'   Útest_fi_optional_inputz,TestFunctionInference.test_fi_optional_inputT   s  € ðˆð 	�Š�D�;˜-¨­k¨]Ñ;Ô;Ð;à�Š�D�;­Ð1°2½°}ÑEÔEÐEðˆð 	�Š�D�;­µZÐ@À"ÅzÀlÑSÔSÐSØ�Š�D�;­µ[ÐAÀ2ÍÀ}ÑUÔUÐUà�Š�D�;­µXÐ>ÀÅ[ÀMÑRÔRÐRðˆð 	�Š�D�;­µ+Ð>ÀÅ[ÀMÑRÔRÐRð 	×Ò˜$¥­h½
Ð CÀRÑHÔHÐHÐHÐHr)   N)r   r   r   r   r   r   r   r   )r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__r(   r/   r5   r=   rB   © r)   r'   r   r      sx   € € € € € ð8ð 8ð 8ð 8ðQð Qð Qð Qð
@ð 
@ð 
@ðFð Fð Fð"Ið "Ið "Ið "Ið "Ir)   r   Ú__main__)Ú
__future__r   ÚunittestÚtypingr   Úshape_inference_testr   r   Úonnx.helperÚonnx.parserÚonnx.shape_inferencer   r   Úcollections.abcr   r8   Úmake_tensor_type_protor1   rA   r@   r2   r:   r?   r   rC   ÚmainrF   r)   r'   ú<module>rR      s…  ðð #Ð "Ð "Ð "Ð "Ð "à €€€Ø  Ð  Ð  Ð  Ð  Ð  à 9Ð 9Ð 9Ð 9Ð 9Ð 9à €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø *Ð *Ð *Ð *Ð *Ð *Ð *Ð *àð )Ø(Ð(Ð(Ð(Ð(Ð(àŒk×0Ò0°°DÑ9Ô9€ØŒk×0Ò0°°DÑ9Ô9€ØŒ[×/Ò/°°4Ñ8Ô8€
ØŒk×0Ò0°°DÑ9Ô9€Ø”×2Ò2°2°tÑ<Ô<€Øˆ9‰;Œ;€ðZIð ZIð ZIð ZIð ZIÐ4ñ ZIô ZIð ZIðz ˆzÒÐØ€H„M�O„O€O€O€Oð Ðr)   