| 180 | } |
| 181 | |
| 182 | Status RunRestoreCheckpoint( |
| 183 | const RunOptions& run_options, |
| 184 | const std::string& full_ckpt_name, |
| 185 | const std::string& savedmodel_dir, |
| 186 | const StringPiece restore_op_name, |
| 187 | const StringPiece variable_filename_const_op_name, |
| 188 | const StringPiece incr_variable_filename_const_op_name, |
| 189 | const std::vector<AssetFileDef>& asset_file_defs, |
| 190 | Session* session) { |
| 191 | LOG(INFO) << "Restoring checkpoint."; |
| 192 | // Find path to variables to be restored in export directory. |
| 193 | // Add variables to the graph. |
| 194 | Tensor variables_path_tensor(DT_STRING, TensorShape({})); |
| 195 | variables_path_tensor.scalar<string>()() = full_ckpt_name; |
| 196 | |
| 197 | std::vector<std::pair<string, Tensor>> inputs = { |
| 198 | {string(variable_filename_const_op_name), variables_path_tensor}}; |
| 199 | |
| 200 | util::AddAssetsTensorsToInputs(savedmodel_dir, asset_file_defs, &inputs); |
| 201 | |
| 202 | RunMetadata run_metadata; |
| 203 | return util::RunOnce(run_options, inputs, {}, {string(restore_op_name)}, |
| 204 | nullptr /* outputs */, &run_metadata, session); |
| 205 | } |
| 206 | |
| 207 | |
| 208 | Status RunRestore(const RunOptions& run_options, const string& export_dir, |
no test coverage detected