+
    9i                     p    ^ RI t ^ RIHt ^ RIt^ RIHtHtHtH	t	 ^
t
R tR tR t]R8X  d
   ]! 4        R# R# )    N)Path)
load_modelnumpy_helperonnx_pb
save_modelc                    V P                   .pV'       Ed:   VP                  ^ 4      pV! V4       VP                   EF  pVP                   F  pVP                  \
        P                  P                  P                  8X  dH   \        VP                  \
        P                  4      '       g   Q hVP                  VP                  4       VP                  \
        P                  P                  P                  8X  g   K  VP                   F6  p\        V\
        P                  4      '       g   Q hVP                  V4       K8  	  K  	  EK  	  EKB  R# )r   N)graphpopnode	attributetyper   AttributeProtoAttributeTypeGRAPH
isinstanceg
GraphProtoappendGRAPHSgraphs)modelfuncgraph_queuer	   r   attrr   s   &&     _/var/www/html/photoedit/myenv/lib/python3.14/site-packages/onnxruntime/tools/onnx_randomizer.pygraph_iteratorr      s    ;;-K
+"UJJD99 6 6 D D J JJ%dffg.@.@AAAA&&tvv.99 6 6 D D K KK![[)!W-?-?@@@@#**1- ) '      c                    V P                    F  p\        P                  ! V4      pVP                  \        8  g   K0  \
        P                  P                  VP                  4       VP                  4       VP                  R 7      P                  VP                  4      p\        P                  ! W1P                  4      pVP                  V4       K  	  R# ))sizeN)initializerr   to_arrayr   SIZE_THRESHOLDnprandomuniformminmaxshapeastypedtype
from_arraynameCopyFrom)r	   i_tensorarrayrandom_arrayo_tensors   &    r   randomize_graph_initializerr2   %   s    %%%%h/::&99,,UYY[%))+EKK,X__`e`k`klL#..|]]KHh' &r   c                  Z   \         P                  ! R R7      p V P                  R\        RRR7       V P                  R\        RRR7       V P                  RR	R
RR7       V P                  RR	R
RR7       V P	                  4       pRpVP
                  '       d   \        VP                  4      P                  \        VP                  4      P                  8X  d   \        R4      hVP                  '       d'   \        VP                  4      P                  R,           p\        VP                  4      P                  P                  RRR7       \        VP                  VP
                  R7      p\        V\         4       \#        VVP                  VP
                  VP                  VR7       R# )z&Randomize the weights of an ONNX model)descriptionz-mTzinput onnx model path)r   requiredhelpz-ozoutput onnx model pathz--use_external_data_formatF
store_truez%Store or Save in external data format)r5   actionr6   z--all_tensors_to_one_filezSave all tensors to one fileNzNPlease specify output directory with different parent path to input directory.z.data)parentsexist_ok)load_external_data)save_as_external_dataall_tensors_to_one_filelocation)argparseArgumentParseradd_argumentstr
parse_argsuse_external_data_formatr   mparentoRuntimeErrorr=   r,   mkdirr   r   r2   r   )parserargs	data_path
onnx_models       r   mainrN   /   sa   $$1YZF
3<ST
3<TU
$4	   #+	   DI$$$<$tvv,"5"55opp'''TVV))G3ILdT:DFFt7T7TUJ::;";; $ < <r   __main__)r?   pathlibr   numpyr#   onnxr   r   r   r   r"   r   r2   rN   __name__ r   r   <module>rU      sA       > >
 . ("J zF r   