MCPcopy Create free account
hub / github.com/Tencent/embedx / Load

Method Load

src/tools/model_server.cc:48–73  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46ModelServer::~ModelServer() {}
47
48bool ModelServer::Load(const std::string& file) {
49 AutoInputFileStream is;
50 if (!is.Open(file)) {
51 DXERROR("Failed to open: %s.", file.c_str());
52 return false;
53 }
54
55 DXINFO("Loading graph from: %s...", file.c_str());
56 graph_.reset(new Graph);
57 if (!graph_->Read(is)) {
58 return false;
59 }
60 DXCHECK(graph_->target_size() > target_type_);
61 target_name_ = graph_->target(target_type_).name();
62 DXINFO("Done.");
63
64 DXINFO("Loading model from: %s...", file.c_str());
65 model_.reset(new Model);
66 model_->Init(graph_.get());
67 if (!model_->Read(is)) {
68 return false;
69 }
70
71 DXINFO("Done.");
72 return true;
73}
74
75bool ModelServer::LoadGraph(const std::string& file) {
76 graph_.reset(new Graph);

Callers 3

mainFunction · 0.45
LoadGraphMethod · 0.45
LoadModelMethod · 0.45

Calls 2

OpenMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected