Ë
    cQêj	
  ã                  ól   — d dl mZ d dlZd dlZd dlZd dlZd dlZddlmZm	Z	m
Z
 d„ Zedk(  r e«        yy)é    )ÚannotationsNé   )Úfix_output_shapesÚmake_dim_param_fixedÚmake_input_shape_fixedc                 ó4  — t        j                  t        j                  j	                  t
        «      › dt        j                  › �d¬«      } | j                  dt        dd¬«       | j                  dt        dd	¬«       | j                  d
t        dd¬«       | j                  dd„ dd¬«       | j                  dt        j                  d¬«       | j                  dt        j                  d¬«       | j                  «       }|j                  r|j                  ss|j                  s|j                  r[|j                  r|j                   rC|j                   dk  s4|j                  rX|j"                  rt%        d„ |j"                  D «       «      r0t'        d«       | j)                  «        t+        j,                  d«       t/        j0                  t        |j2                  j5                  d¬«      «      «      }|j                  r,t7        |j8                  |j                  |j                   «       n+t;        |j8                  |j                  |j"                  «       t=        |«       t/        j>                  |t        |j@                  j5                  «       «      «       y )Nú:zÃ
                                     Assign a fixed value to a dim_param or input shape
                                     Provide either dim_param and dim_value or input_name and input_shape.)Údescriptionz--dim_paramFz8Symbolic parameter name. Provide dim_value if specified.)ÚtypeÚrequiredÚhelpz--dim_valuez:Value to replace dim_param with in the model. Must be > 0.z--input_namezGModel input name to replace shape of. Provide input_shape if specified.z--input_shapec                ó\   — | j                  d«      D �cg c]  }t        |«      ‘Œ c}S c c}w )Nú,)ÚsplitÚint)ÚxÚis     úo/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/onnxruntime/tools/make_dynamic_shape_fixed.pyú<lambda>z1make_dynamic_shape_fixed_helper.<locals>.<lambda>&   s    € ¨¯©°«Ö5 1œ˜A�Ò5€ ùÒ5s   ”)z€Shape to use for input_shape. Provide comma separated list for the shape. All values must be > 0. e.g. --input_shape 1,3,256,256Úinput_modelz%Provide path to ONNX model to update.)r   r   Úoutput_modelz,Provide path to write updated ONNX model to.r   c              3  ó&   K  — | ]	  }|d k  –— Œ y­w)r   N© )Ú.0Úvalues     r   ú	<genexpr>z2make_dynamic_shape_fixed_helper.<locals>.<genexpr>5   s   è ø€ Ò<eÈ5¸UÀQ½YÑ<eùs   ‚zInvalid usage.éÿÿÿÿT)Ústrict)!ÚargparseÚArgumentParserÚosÚpathÚbasenameÚ__file__Úmake_dynamic_shape_fixed_helperÚ__name__Úadd_argumentÚstrr   ÚpathlibÚPathÚ
parse_argsÚ	dim_paramÚ
input_nameÚ	dim_valueÚinput_shapeÚanyÚprintÚ
print_helpÚsysÚexitÚonnxÚloadr   Úresolver   Úgraphr   r   Úsaver   )ÚparserÚargsÚmodels      r   r%   r%      s  € Ü×$Ñ$Ü�7‰7×ÑœHÓ%Ð
& aÔ(G×(PÑ(PÐ'QÐRðnô€Fð ×ÑØœC¨%Ð6pð ô ð ×ÑØœC¨%Ð6rð ô ð ×ÑØÜØØVð	 ô ð ×ÑØÙ5ØðAð	 ô ð ×Ñ˜¬G¯L©LÐ?fÐÔgØ
×Ñ˜¬W¯\©\Ð@nÐÔoà×ÑÓ€Dð 
�Š˜DŸOšOØ—’ t§¢Ø�NŠN D§N¢N°d·n±nÀqÒ6HØ�OŠO T×%5Ò%5¼Ñ<eÐTX×TdÑTdÔ<eÔ9eäÐÔØ×ÑÔÜ�‰�Œä�I‰I”c˜$×*Ñ*×2Ñ2¸$Ð2Ó?Ó@ÓA€Eà‡~‚~Ü˜UŸ[™[¨$¯.©.¸$¿.¹.ÕIä˜uŸ{™{¨D¯O©O¸T×=MÑ=MÔNô �eÔä‡I�Iˆe”S˜×*Ñ*×2Ñ2Ó4Ó5Õ6ó    Ú__main__)Ú
__future__r   r   r!   r)   r3   r5   Úonnx_model_utilsr   r   r   r%   r&   r   r=   r   ú<module>rA      s:   ðõ #ã Û 	Û Û 
ã ç ]Ñ ]ò57ðp ˆzÒÙ#Õ%ð r=   