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

Function RunMainOp

serving/processor/serving/util.cc:270–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270Status RunMainOp(const RunOptions& run_options, const string& export_dir,
271 const MetaGraphDef& meta_graph_def,
272 const std::vector<AssetFileDef>& asset_file_defs,
273 Session* session, const string& main_op_key) {
274 LOG(INFO) << "Running MainOp with key " << main_op_key
275 << " on SavedModel bundle.";
276 const auto& collection_def_map = meta_graph_def.collection_def();
277 const auto main_op_it = collection_def_map.find(main_op_key);
278 if (main_op_it != collection_def_map.end()) {
279 if (main_op_it->second.node_list().value_size() != 1) {
280 return errors::FailedPrecondition(
281 strings::StrCat("Expected exactly one main op in : ", export_dir));
282 }
283 std::vector<std::pair<string, Tensor>> inputs;
284 util::AddAssetsTensorsToInputs(export_dir, asset_file_defs, &inputs);
285 RunMetadata run_metadata;
286 const StringPiece main_op_name = main_op_it->second.node_list().value(0);
287 return util::RunOnce(run_options, inputs, {}, {string(main_op_name)},
288 nullptr /* outputs */, &run_metadata, session);
289 }
290 return Status::OK();
291}
292
293Status RunMainOp(const RunOptions& run_options, const string& export_dir,
294 const MetaGraphDef& meta_graph_def,

Callers 2

RunRestoreOpsMethod · 0.85
CreateModelSessionMethod · 0.85

Calls 8

FailedPreconditionFunction · 0.85
AddAssetsTensorsToInputsFunction · 0.70
RunOnceFunction · 0.70
StrCatFunction · 0.50
findMethod · 0.45
endMethod · 0.45
valueMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected