From 64aa55eac8908cd359fb314e648443144734eb8c Mon Sep 17 00:00:00 2001 From: Tao Qin <48697806+TaoQinMS@users.noreply.github.com> Date: Tue, 21 May 2019 11:31:20 -0700 Subject: [PATCH] Re-order InferenceSession::session_state_ in the member declaration (#1068) * Re-order InferenceSession::session_state_ in the member declaration * fix initialization list --- onnxruntime/core/session/inference_session.cc | 6 +++--- onnxruntime/core/session/inference_session.h | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/onnxruntime/core/session/inference_session.cc b/onnxruntime/core/session/inference_session.cc index 4544abf7c3..8bd27e43b8 100644 --- a/onnxruntime/core/session/inference_session.cc +++ b/onnxruntime/core/session/inference_session.cc @@ -89,11 +89,11 @@ inline std::basic_string GetCurrentTimeString() { } // namespace InferenceSession::InferenceSession(const SessionOptions& session_options, logging::LoggingManager* logging_manager) - : session_state_(execution_providers_, - session_options.enable_mem_pattern && session_options.enable_sequential_execution), - session_options_{session_options}, + : session_options_{session_options}, graph_transformation_mgr_{session_options_.max_num_graph_transformation_steps}, logging_manager_{logging_manager}, + session_state_(execution_providers_, + session_options.enable_mem_pattern && session_options.enable_sequential_execution), insert_cast_transformer_{"CastFloat16Transformer"} { ORT_ENFORCE(Environment::IsInitialized(), "Environment must be initialized before creating an InferenceSession."); diff --git a/onnxruntime/core/session/inference_session.h b/onnxruntime/core/session/inference_session.h index af3c59f4d9..0ba33ea7a3 100644 --- a/onnxruntime/core/session/inference_session.h +++ b/onnxruntime/core/session/inference_session.h @@ -312,9 +312,6 @@ class InferenceSession { // if they need. std::shared_ptr model_; - // Immutable state for each op in the model. Shared by all executors. - SessionState session_state_; - // names of model outputs used for quick validation. std::unordered_set model_output_names_; @@ -391,6 +388,12 @@ class InferenceSession { ExecutionProviders execution_providers_; + protected: + // Immutable state for each op in the model. Shared by all executors. + // It has a dependency on execution_providers_. + SessionState session_state_; + + private: KernelRegistryManager kernel_registry_manager_; std::list> custom_schema_registries_; @@ -417,6 +420,5 @@ class InferenceSession { //CustomRegistry objects own the corresponding KernelRegistry and OnnxRuntimeOpSchemaRegistry objects. //So its lifetime should be same as its constituents. This vector is to extend the lifetime of the owner. std::vector> custom_registries_; - }; } // namespace onnxruntime