onnxruntime/onnxruntime/python/onnxruntime_pybind_state_common.h
liqunfu c3c4ce5ceb
refactor prototypes into headers (#4337)
* refactor prototypes into headers
2020-06-26 12:02:14 -07:00

56 lines
1.4 KiB
C++

// 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<TAllocator>();
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<ISink>{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<std::string>& provider_types);
}
}