| 243 | } |
| 244 | |
| 245 | Status RunIncrMainOp(const RunOptions& run_options, const string& export_dir, |
| 246 | const MetaGraphDef& meta_graph_def, |
| 247 | const std::vector<AssetFileDef>& asset_file_defs, |
| 248 | Session* session, const string& main_op_key, |
| 249 | thread::ThreadPoolOptions thread_opt, |
| 250 | Session::CallableHandle** handler) { |
| 251 | LOG(INFO) << "Running MainOp with key " << main_op_key |
| 252 | << " on SavedModel bundle."; |
| 253 | const auto& collection_def_map = meta_graph_def.collection_def(); |
| 254 | const auto main_op_it = collection_def_map.find(main_op_key); |
| 255 | if (main_op_it != collection_def_map.end()) { |
| 256 | if (main_op_it->second.node_list().value_size() != 1) { |
| 257 | return errors::FailedPrecondition( |
| 258 | strings::StrCat("Expected exactly one main op in : ", export_dir)); |
| 259 | } |
| 260 | std::vector<std::pair<string, Tensor>> inputs; |
| 261 | util::AddAssetsTensorsToInputs(export_dir, asset_file_defs, &inputs); |
| 262 | RunMetadata run_metadata; |
| 263 | const StringPiece main_op_name = main_op_it->second.node_list().value(0); |
| 264 | return util::RunOnce(run_options, inputs, {}, {string(main_op_name)}, |
| 265 | nullptr /* outputs */, &run_metadata, session, thread_opt, handler); |
| 266 | } |
| 267 | return Status::OK(); |
| 268 | } |
| 269 | |
| 270 | Status RunMainOp(const RunOptions& run_options, const string& export_dir, |
| 271 | const MetaGraphDef& meta_graph_def, |
no test coverage detected