Repository navigation
Expand file tree
/
Copy pathsession_base.cpp
More file actions
76 lines (58 loc) · 2.03 KB
/
Copy pathsession_base.cpp
File metadata and controls
76 lines (58 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "engine/framework/runtime/session_base.h"
namespace engine::runtime {
RuntimeSessionBase::RuntimeSessionBase(const SessionOptions & options)
: options_(options),
execution_context_(options.backend),
graph_executor_(execution_context_) {}
engine::core::ExecutionContext & RuntimeSessionBase::execution_context() noexcept {
return execution_context_;
}
const engine::core::ExecutionContext & RuntimeSessionBase::execution_context() const noexcept {
return execution_context_;
}
ArtifactStore & RuntimeSessionBase::artifacts() noexcept {
return artifacts_;
}
const ArtifactStore & RuntimeSessionBase::artifacts() const noexcept {
return artifacts_;
}
RuntimeCache & RuntimeSessionBase::cache() noexcept {
return cache_;
}
const RuntimeCache & RuntimeSessionBase::cache() const noexcept {
return cache_;
}
RuntimeWorkspace & RuntimeSessionBase::workspace() noexcept {
return workspace_;
}
const RuntimeWorkspace & RuntimeSessionBase::workspace() const noexcept {
return workspace_;
}
GraphExecutor & RuntimeSessionBase::graph_executor() noexcept {
return graph_executor_;
}
const GraphExecutor & RuntimeSessionBase::graph_executor() const noexcept {
return graph_executor_;
}
void RuntimeSessionBase::mark_prepared() noexcept {
prepared_ = true;
}
void RuntimeSessionBase::require_prepared(std::string_view operation) const {
if (!prepared_) {
throw std::runtime_error(
"session prepare() must be called before " + std::string(operation));
}
}
void RuntimeSessionBase::trace(engine::debug::LogLevel level, std::string_view category, std::string_view message) const {
engine::debug::log_message(level, category, message);
}
engine::debug::ScopeTimer RuntimeSessionBase::profile(
engine::debug::LogLevel level,
std::string_view category,
std::string_view name) const {
return engine::debug::ScopeTimer(level, category, name);
}
const SessionOptions & RuntimeSessionBase::options() const noexcept {
return options_;
}
} // namespace engine::runtime