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

Function LoadGraph

tensorflow/contrib/pi_examples/label_image/label_image.cc:212–227  ·  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

210// Reads a model graph definition from disk, and creates a session object you
211// can use to run it.
212Status LoadGraph(string graph_file_name,
213 std::unique_ptr<tensorflow::Session>* session) {
214 tensorflow::GraphDef graph_def;
215 Status load_graph_status =
216 ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
217 if (!load_graph_status.ok()) {
218 return tensorflow::errors::NotFound("Failed to load compute graph at '",
219 graph_file_name, "'");
220 }
221 session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
222 Status session_create_status = (*session)->Create(graph_def);
223 if (!session_create_status.ok()) {
224 return session_create_status;
225 }
226 return Status::OK();
227}
228
229// Analyzes the output of the Inception graph to retrieve the highest scores and
230// their positions in the tensor, which correspond to categories.

Callers 1

mainFunction · 0.70

Calls 8

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

Tested by

no test coverage detected