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

Function LoadGraph

tensorflow/contrib/pi_examples/camera/camera.cc:239–254  ·  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

237// Reads a model graph definition from disk, and creates a session object you
238// can use to run it.
239Status LoadGraph(string graph_file_name,
240 std::unique_ptr<tensorflow::Session>* session) {
241 tensorflow::GraphDef graph_def;
242 Status load_graph_status =
243 ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
244 if (!load_graph_status.ok()) {
245 return tensorflow::errors::NotFound("Failed to load compute graph at '",
246 graph_file_name, "'");
247 }
248 session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
249 Status session_create_status = (*session)->Create(graph_def);
250 if (!session_create_status.ok()) {
251 return session_create_status;
252 }
253 return Status::OK();
254}
255
256// Analyzes the output of the Inception graph to retrieve the highest scores and
257// 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