Reads a model graph definition from disk, and creates a session object you can use to run it.
| 210 | // Reads a model graph definition from disk, and creates a session object you |
| 211 | // can use to run it. |
| 212 | Status 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. |
no test coverage detected