RunInitOp will return OK if the initialization op was run successfully. An empty init_op_name indicates that there are no init ops to run.
| 225 | // RunInitOp will return OK if the initialization op was run successfully. |
| 226 | // An empty init_op_name indicates that there are no init ops to run. |
| 227 | Status RunInitOp(const RunOptions& run_options, const string& export_dir, |
| 228 | const MetaGraphDef& meta_graph_def, |
| 229 | const std::vector<AssetFileDef>& asset_file_defs, |
| 230 | Session* session, const string& init_op_name) { |
| 231 | if (!init_op_name.empty()) { |
| 232 | LOG(INFO) << "Running initialization op on SavedModel bundle at path: " |
| 233 | << export_dir; |
| 234 | std::vector<std::pair<string, Tensor>> inputs; |
| 235 | AddAssetsTensorsToInputs(export_dir, asset_file_defs, &inputs); |
| 236 | RunMetadata run_metadata; |
| 237 | return RunOnce(run_options, inputs, {}, {init_op_name}, |
| 238 | nullptr /* outputs */, &run_metadata, session); |
| 239 | } |
| 240 | return Status::OK(); |
| 241 | } |
| 242 | |
| 243 | // A SavedModel may store the name of the initialization op to run in the |
| 244 | // in the SignatureDef (v2) or a collection (v1). If an init_op collection |
no test coverage detected