MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / LoadGraph

Function LoadGraph

tensorflow/examples/multibox_detector/main.cc:168–183  ·  view source on GitHub ↗

Reads a model graph definition from disk, and creates a session object you can use to run it.

Source from the content-addressed store, hash-verified

166// Reads a model graph definition from disk, and creates a session object you
167// can use to run it.
168Status LoadGraph(const string& graph_file_name,
169 std::unique_ptr<tensorflow::Session>* session) {
170 tensorflow::GraphDef graph_def;
171 Status load_graph_status =
172 ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
173 if (!load_graph_status.ok()) {
174 return tensorflow::errors::NotFound("Failed to load compute graph at '",
175 graph_file_name, "'");
176 }
177 session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
178 Status session_create_status = (*session)->Create(graph_def);
179 if (!session_create_status.ok()) {
180 return session_create_status;
181 }
182 return Status::OK();
183}
184
185// Analyzes the output of the MultiBox graph to retrieve the highest scores and
186// their positions in the tensor, which correspond to individual box detections.

Callers 1

mainFunction · 0.70

Calls 8

ReadBinaryProtoFunction · 0.85
DefaultFunction · 0.85
NotFoundFunction · 0.85
NewSessionFunction · 0.50
SessionOptionsStruct · 0.50
okMethod · 0.45
resetMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected