
    SiZ                       S SK Jr  S SKrS SKJr  S SKJr  S SKrS SKrS SK	rS SK
rS SKJrJr  \(       a  S SKJr  \R                  R!                  SS5      r\R                  R!                  SS5      r\R                  R!                  S	S5      r\R                  R!                  S
S5      r\R                  R!                  SS5      r\" 5       r " S S\5      r\S:X  a  \R2                  " 5         gg)    )annotationsN)TYPE_CHECKING)TestShapeInferenceHelper)AttributeProto	TypeProto)Sequence            
   c                  V    \ rS rSr        S	S jr      S
S jrS rS rS rSr	g)TestFunctionInference   c                   [         R                  R                  U5      n[         R                  R	                  XRU5      nU R                  [        U5      [        U5      5        [        XFSS9 H  u  pxU R                  Xx5        M     g )NT)strict)	onnxparserparse_functionshape_inferenceinfer_function_output_typesassertEquallenzip_compare_value_infos)	selffunction_textinput_types
attributesexpected_output_typesfunctionresultexpectedactuals	            `/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/onnx/test/function_inference_test.py_checkTestFunctionInference._check   ss     ;;--m<%%AA:
 	23S[A #$9$ OH%%h7 !P    c                   ^^^ [         R                  R                  U5      mUUU4S jnU R                  [         R                  R
                  U5        g )Nc                 H   > [         R                  R                  TTT 5        g )N)r   r   r   )r   r!   r   s   r%   invoke_inference<TestFunctionInference._check_fails.<locals>.invoke_inference4   s      <<+zr(   )r   r   r   assertRaisesr   InferenceError)r   r   r   r   r+   r!   s     `` @r%   _check_fails"TestFunctionInference._check_fails,   s=     ;;--m<	
 	$..==?OPr(   c                    SnU R                  U[        [        // [        /5        U R                  U[        [        // [        /5        U R                  U[        [        // 5        g )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_basic#TestFunctionInference.test_fi_basic;   sT     	D;4b;-HD;4b;-H$k :B?r(   c                   Sn[         R                  R                  SS5      nU R                  U[        /U/[
        /5        [         R                  R                  SS5      nU R                  U[        /U/[        /5        g )Nz
            <opset_import: [ "" : 18 ], domain: "local">
            CastTo <dtype> (x) => (y) {
                y = Cast <to : int = @dtype> (x)
            }
        dtyper   r   )r   helpermake_attributer&   r2   r3   float16_type_)r   r5   dtype_6dtype_10s       r%   test_fi_attribute'TestFunctionInference.test_fi_attributeG   sg     ++,,Wa8D;-'[MB;;--gr:D;-(m_Er(   c                   SnU R                  U[        // [        /5        U R                  U[        [        // [        /5        SnU R                  U[        [        [        // [        /5        U R                  U[        [        [        // [        /5        U R                  U[        [        [        // [        /5        SnU R                  U[        [        [        // [        /5        U R                  U[        [        [        // 5        g )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&   r2   no_type_
int8_type_uint8_type_r/   r4   s     r%   test_fi_optional_input,TestFunctionInference.test_fi_optional_inputT   s     	D;-k];D;12}E 	D;Z@"zlSD;[A2}UD;X>[MR 	D;+>[MR 	$h
 CRHr(    N)r   strr   Sequence[TypeProto]r   Sequence[AttributeProto]r    rI   )r   rH   r   rI   r   rJ   )
__name__
__module____qualname____firstlineno__r&   r/   r6   r?   rE   __static_attributes__rG   r(   r%   r   r      sd    88 )8 -	8
  38QQ )Q -	Q
@F"Ir(   r   __main__)
__future__r   unittesttypingr   shape_inference_testr   r   onnx.helperonnx.parseronnx.shape_inferencer   r   collections.abcr   r:   make_tensor_type_protor2   rD   rC   r3   r<   rB   r   rK   mainrG   r(   r%   <module>r[      s    #    9     *(kk00D9kk00D9[[//48
kk00D9222t<;ZI4 ZIz zMMO r(   