
    fPi	
                    x    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             dS dS )    )annotationsN   )fix_output_shapesmake_dim_param_fixedmake_input_shape_fixedc                    t          j        t          j                            t
                     dt          j         d          } |                     dt          dd           |                     dt          dd	           |                     d
t          dd           |                     dd dd           |                     dt          j        d           |                     dt          j        d           |                                 }|j        r|j        sS|j        s|j        rE|j        r|j        r7|j        dk     s,|j        r\|j        rt%          d |j        D                       r7t'          d           |                                  t+          j        d           t/          j        t          |j                            d                              }|j        r!t7          |j        |j        |j                   n t;          |j        |j        |j                   t=          |           t/          j        |t          |j                                                              d S )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                @    d |                      d          D             S )Nc                ,    g | ]}t          |          S  )int).0is     ~/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/onnxruntime/tools/make_dynamic_shape_fixed.py
<listcomp>zEmake_dynamic_shape_fixed_helper.<locals>.<lambda>.<locals>.<listcomp>&   s    5551A555    ,)split)xs    r   <lambda>z1make_dynamic_shape_fixed_helper.<locals>.<lambda>&   s    55555 r   zShape 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     V  dS )r   Nr   )r   values     r   	<genexpr>z2make_dynamic_shape_fixed_helper.<locals>.<genexpr>5   s&      <e<e5UQY<e<e<e<e<e<er   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H%%RR(G(PRRn  F C%6p     C%6r     V	     55A	     GL?fggg
W\@noooD 
 O'+ N %)N 7;nq6H6HO 7I%)%5 7I9<<e<eTXTd<e<e<e9e9e 7I 	Ic$*22$2??@@AAE~ OU[$.$.IIIIu{DOT=MNNN eIeS*22445566666r   __main__)
__future__r   r"   r$   r,   r6   r8   onnx_model_utilsr   r   r   r(   r)   r   r   r   <module>rC      s    # " " " " "  				  



  ] ] ] ] ] ] ] ] ] ]57 57 57p z##%%%%% r   