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