+
    G-jØ%  ã                   ó²   € ^ RI t ^ RIt^ RIt^ RIHt ^ RIt^ RIt^ RIHt ^ RI	H
t
Ht ^RIHt ^RIHt ^RIHtHt ] P&                  ! ]4      tR
R R	 lltR# )é    N)ÚPath)ÚSymbolicShapeInference)Úextract_raw_data_from_modelÚhas_external_data)ÚReplaceUpsampleWithResize)Ú	ONNXModel)Úadd_pre_process_metadataÚ&save_and_reload_model_with_shape_inferc                ó8  € V ^8„  d   QhR\         \        ,          \        P                  ,          R,          R\         \        ,          R,          R\        R\        R\        R\        R\
        R	\        R
\
        R\        R\        R\         R,          R\
        RR/# )é   Úinput_modelNÚoutput_model_pathÚskip_optimizationÚskip_onnx_shapeÚskip_symbolic_shapeÚ
auto_mergeÚint_maxÚguess_output_rankÚverboseÚsave_as_external_dataÚall_tensors_to_one_fileÚexternal_data_locationÚexternal_data_size_thresholdÚreturn)Ústrr   ÚonnxÚ
ModelProtoÚboolÚint)Úformats   "Úy/Volumes/fast/ai/experiments/nudenet-smoke/.venv/lib/python3.14/site-packages/onnxruntime/quantization/shape_inference.pyÚ__annotate__r"      sÃ   € ÷ r,ñ r,Ü”t•œdŸo™oÕ-°Õ4ðr,äœT•z DÕ(ðr,ô ðr,ô ð	r,ô
 ðr,ô ðr,ô ðr,ô ðr,ô ðr,ô  ðr,ô "ðr,ô   $�Jðr,ô #&ðr,ð 
ñr,ó    c                ó°	  € V f   VP                  RR4      p V f   Q hVf   Q R4       h\        P                  ! RR7      ;_uu_ 4       p\        V4      p\	        V \
        P                  4      '       d   T M\
        P                  ! V 4      pVP                   Uu. uF*  pVP                  '       d   VP                  R8X  g   K(  VNK,  	  pp\        V4      ^8X  di   V^ ,          P                  pV^
8:  dO   \        \        V4      V4      P                  4        \
        P                  P!                  V^4      p\#        V4      pV'       g0   \$        P'                  R4       \(        P*                  ! VVVVV4      pV'       Ege   V'       gQ   \-        VR,          4      p V	'       d   \
        P.                  ! VV R	V
VR
R7       M\
        P0                  ! VV 4       Rp\-        VR,          4      p \2        P4                  ! 4       pVVn        \2        P8                  P:                  Vn        \	        V \
        P                  4      '       d`   \?        V 4      '       d   \A        R4      h\C        V 4      w  ppVPE                  \G        V4      \G        V4      4       V PI                  4       p M"V'       d   V	'       d   VPK                  RR4       \2        PL                  ! V VR.R7      p?Tp V'       gô   VeQ   \-        VR,          4      p V	'       d   \
        P.                  ! VV R	V
VR
R7       M\
        P0                  ! VV 4       Rp\	        V \
        P                  4      '       d8   \-        \        V4      R,          4      p \
        P.                  ! VV R	V
VR
R7       \-        VR,          4      p\
        PV                  PY                  V V4       \
        P                  ! V4      pRRR4       Xf9   \	        V \
        P                  4      '       d   T M\
        P                  ! V 4      p\[        V4       V	'       d    \
        P.                  ! VVR	V
VVR
R7       R# \
        P0                  ! VV4       R# u upi   \N         dB    \$        PQ                  R4       \$        PQ                  \R        PT                  ! 4       4        ELÜi ; i  + '       g   i     Lë; i)a(  Shape inference and model optimization, in preparation for quantization.

Args:
    input_model: Path to the input model file or ModelProto
    output_model_path: Path to the output model file
    skip_optimization: Skip model optimization step if true. This may result in ONNX shape
        inference failure for some models.
    skip_onnx_shape: Skip ONNX shape inference. Symbolic shape inference is most effective
        with transformer based models. Skipping all shape inferences may
        reduce the effectiveness of quantization, as a tensor with unknown
        shape can not be quantized.
    skip_symbolic_shape: Skip symbolic shape inference. Symbolic shape inference is most
        effective with transformer based models. Skipping all shape
        inferences may reduce the effectiveness of quantization, as a tensor
        with unknown shape can not be quantized.
    auto_merge: For symbolic shape inference, automatically merge symbolic dims when
        conflict happens.
    int_max: For symbolic shape inference, specify the maximum value for integer to be
        treated as boundless for ops like slice
    guess_output_rank: Guess output rank to be the same as input 0 for unknown ops
    verbose: Logs detailed info of inference, 0: turn off, 1: warnings, 3: detailed
    save_as_external_data: Saving an ONNX model to external data
    all_tensors_to_one_file: Saving all the external data to one file
    external_data_location: The file location to save the external file
    external_data_size_threshold: The size threshold for external data
NÚinput_model_pathzoutput_model_path is required.z
pre.quant.)Úprefixzai.onnxz&Performing symbolic shape inference...zsymbolic_shape_inferred.onnxTF)r   r   Úsize_thresholdÚconvert_attributezoptimized.onnxzÒModelProto has external data not loaded into memory, ORT cannot create session. Please load external data before calling this function. See https://onnx.ai/onnx/repo-docs/ExternalData.html for more information.z7session.optimized_model_external_initializers_file_namezoptimized.onnx.dataÚCPUExecutionProvider)Ú	providerszYONNX Runtime Model Optimization Failed! Consider rerun with option `--skip_optimization'.zmodel_input.onnxzonnx_shape_inferred.onnx)r   r   Úlocationr'   r(   ).ÚpopÚtempfileÚTemporaryDirectoryr   Ú
isinstancer   r   ÚloadÚopset_importÚdomainÚlenÚversionr   r   ÚapplyÚversion_converterÚconvert_versionr
   ÚloggerÚinfor   Úinfer_shapesr   Ú
save_modelÚsaveÚonnxruntimeÚSessionOptionsÚoptimized_model_filepathÚGraphOptimizationLevelÚORT_ENABLE_BASICÚgraph_optimization_levelr   Ú
ValueErrorr   Úadd_external_initializersÚlistÚSerializeToStringÚadd_session_config_entryÚInferenceSessionÚ	ExceptionÚerrorÚ	tracebackÚ
format_excÚshape_inferenceÚinfer_shapes_pathr	   )r   r   r   r   r   r   r   r   r   r   r   r   r   Údeprecated_kwargsÚquant_tmp_dirÚ	temp_pathÚmodelÚopsetÚai_onnx_domainÚopset_versionÚopt_model_pathÚsess_optionÚexternal_namesÚexternal_valuesÚsessÚinferred_model_paths   &&&&&&&&&&&&&,            r!   Úquant_pre_processr\      s   € ðV ÒØ'×+Ñ+Ð,>ÀÓEˆØÒ"Ð"Ð"àÒ(ÐJÐ*JÓJÐ(ä	×	$Ò	$¨L×	9Õ	9¸]Ü˜Ó'ˆ	Ü)¨+´t·±×GÒG‘ÌTÏYÊYÐWbÓMcˆð
 .3×-?Ò-?ÓqÑ-? EÀuÇ|Ç|À|ÐW\×WcÑWcÐgpÑWpŸ%˜%Ñ-?ˆÐqÜˆ~Ó !Ô#Ø*¨1Õ-×5Ñ5ˆMØ Ô"Ü)¬)°EÓ*:¸MÓJ×PÑPÔRÜ×.Ñ.×>Ñ>¸uÀbÓI�Ü>¸uÓE�ç"Ü�K‰KÐ@ÔAÜ*×7Ò7ØØØØ!ØóˆE÷ !Ð ç&ä! )Ð.LÕ"LÓM�ß(Ü—O’OØØ#Ø.2Ø0GØ'CØ*/öô —I’I˜e [Ô1Ø�ä  Ð-=Õ!=Ó>ˆNð5Ü)×8Ò8Ó:�Ø7E�Ô4Ü7B×7YÑ7Y×7jÑ7j�Ô4ä˜k¬4¯?©?×;Ò;Ü(¨×5Ò5Ü(ðióð ô
 7RÐR]Ó6^Ñ3�N OØ×9Ñ9¼$¸~Ó:NÔPTÐUdÓPeÔfØ"-×"?Ñ"?Ó"A‘K÷ )×-BØ×8Ñ8ØQÐShôô #×3Ò3°KÀÐYoÐXpÔq�ð ð )ˆKçð
 Ò Ü! )Ð.LÕ"LÓM�ß(Ü—O’OØØ#Ø.2Ø0GØ'CØ*/öô —I’I˜e [Ô1Ø�ä˜+¤t§¡×7Ò7Ü!¤$ }Ó"5Ð8JÕ"JÓK�Ü—’ØØØ*.Ø,CØ#?Ø&+õô #& iÐ2LÕ&LÓ"MÐÜ× Ñ ×2Ñ2°;Ð@SÔTÜ—I’IÐ1Ó2ˆE÷_ 
:ðb ‚}Ü)¨+´t·±×GÒG‘ÌTÏYÊYÐWbÓMcˆä˜UÔ#çÜ�ŠØØØ"&Ø$;Ø+Ø7Ø#÷	
ô 	�	Š	�%Ð*Ö+ùòu røô~ ô 5Ü—‘Øoôô —‘œY×1Ò1Ó3×4ð	5ú÷M 
:×	9úsx   ÁASÂQ1Â0Q1ÃQ1Ã	BSÅ7SÆSÆA"SÇ.CQ6Ê0Q6Ê8-Q6Ë%	SË/C3SÑ1SÑ6ASÒ>SÓSÓSÓS	)NNFFFFiÿÿÿFr   FFNi   )Úloggingr-   rK   Úpathlibr   r   r=   Ú&onnxruntime.tools.symbolic_shape_inferr   Ú#onnxruntime.transformers.onnx_utilsr   r   Úfusionsr   Ú
onnx_modelr   Úquant_utilsr	   r
   Ú	getLoggerÚ__name__r8   r\   © r#   r!   Ú<module>rg      sD   ðó Û Û Ý ã ã Ý Iß ^å .Ý !ß Yà	×	Ò	˜8Ó	$€÷r,ñ r,r#   