Commits


Preetha Veeramalai authored and GitHub committed 79d47c15309
Enable sorting of initializers (#14631) Add intializers to model proto in sorted order. ### Motivation and Context Onnxruntime OpenVino Execution Provider interacts with Openvino API by passing onnx serialised model proto. Current flow is that onnx serialised model proto will be passed into Read_model() API of OpenVino that creates an OpenVino execution network thats passed to compile_model() API. As part of optimizations we have combined the API's (Read_model and Compile_model) into single compile_model() API that directly accepts serialized onnx model proto. A hash function will be computed on this serialized input for internal Openvino optimizations. This requires the model_proto to be deterministic during each inference requests. With the current flow, the [initializers are added to model_proto](https://github.com/microsoft/onnxruntime/blob/c1ff4b468dfc718f2ceb894a661d68c277cff864/onnxruntime/core/graph/graph_proto_serializer.cc#L48) from an [unordered_map data structure](https://github.com/microsoft/onnxruntime/blob/8ed3dfe0633f5772f1684a5c9f7e68c7acec00d2/onnxruntime/core/providers/shared_library/provider_interfaces.h#L93) that brings in random ordering of these initializers for inference runs. The proposed solution is to add these initializers by iterating through a sorted[ vector consisting of the initializer names](https://github.com/intel/onnxruntime/blob/2c7146cef879daa86336acad24810222ac25f2a9/onnxruntime/core/graph/graph_proto_serializer.cc#L49).