// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. #include "core/common/logging/logging.h" #include "core/common/logging/sinks/cerr_sink.h" #include "core/framework/allocator.h" #include "core/framework/session_options.h" #include "core/session/environment.h" namespace onnxruntime { class InferenceSession; namespace python { using namespace onnxruntime; using namespace onnxruntime::logging; inline const SessionOptions& GetDefaultCPUSessionOptions() { static SessionOptions so; return so; } inline AllocatorPtr& GetAllocator() { static AllocatorPtr alloc = std::make_shared(); return alloc; } class SessionObjectInitializer { public: typedef const SessionOptions& Arg1; // typedef logging::LoggingManager* Arg2; static const std::string default_logger_id; operator Arg1() { return GetDefaultCPUSessionOptions(); } // operator Arg2() { // static LoggingManager default_logging_manager{std::unique_ptr{new CErrSink{}}, // Severity::kWARNING, false, LoggingManager::InstanceType::Default, // &default_logger_id}; // return &default_logging_manager; // } static SessionObjectInitializer Get() { return SessionObjectInitializer(); } }; Environment& get_env(); void InitializeSession(InferenceSession* sess, const std::vector& provider_types); } }