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

Function LoadGraph

tensorflow/examples/label_image/main.cc:187–202  ·  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

185// Reads a model graph definition from disk, and creates a session object you
186// can use to run it.
187Status LoadGraph(const string& graph_file_name,
188 std::unique_ptr<tensorflow::Session>* session) {
189 tensorflow::GraphDef graph_def;
190 Status load_graph_status =
191 ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def);
192 if (!load_graph_status.ok()) {
193 return tensorflow::errors::NotFound("Failed to load compute graph at '",
194 graph_file_name, "'");
195 }
196 session->reset(tensorflow::NewSession(tensorflow::SessionOptions()));
197 Status session_create_status = (*session)->Create(graph_def);
198 if (!session_create_status.ok()) {
199 return session_create_status;
200 }
201 return Status::OK();
202}
203
204// Analyzes the output of the Inception graph to retrieve the highest scores and
205// 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
SessionOptionsStruct · 0.50
okMethod · 0.45
resetMethod · 0.45
CreateMethod · 0.45

Tested by

no test coverage detected