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

Method RunRestoreOps

serving/processor/serving/model_session.cc:187–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187Status ModelSessionMgr::RunRestoreOps(
188 const char* ckpt_name, int64 full_ckpt_version,
189 const char* savedmodel_dir, Session* session,
190 IFeatureStoreMgr* sparse_storage,
191 bool is_incr_ckpt, bool update_sparse,
192 int64_t latest_version) {
193 std::vector<std::pair<std::string, Tensor>> extra_tensors;
194 Tensor sparse_storage_tensor(DT_UINT64, TensorShape({}));
195 sparse_storage_tensor.scalar<uint64>()() =
196 reinterpret_cast<uint64>(sparse_storage);
197 auto sparse_storage_tensor_pair = std::make_pair(
198 GetStoragePointerNodeName(), sparse_storage_tensor);
199 extra_tensors.emplace_back(sparse_storage_tensor_pair);
200
201 Tensor version_tensor(DT_UINT64, TensorShape({}));
202 version_tensor.scalar<uint64>()() = full_ckpt_version;
203 auto version_tensor_pair = std::make_pair(
204 GetModelVersionNodeName(), version_tensor);
205 extra_tensors.emplace_back(version_tensor_pair);
206
207 Tensor is_incr_ckpt_tensor(DT_BOOL, TensorShape({}));
208 is_incr_ckpt_tensor.scalar<bool>()() = is_incr_ckpt;
209 auto is_incr_ckpt_tensor_pair = std::make_pair(
210 GetIncrCkptNodeName(), is_incr_ckpt_tensor);
211 extra_tensors.emplace_back(is_incr_ckpt_tensor_pair);
212
213 TF_RETURN_IF_ERROR(
214 util::RunRestore(*run_options_, ckpt_name, savedmodel_dir,
215 meta_graph_def_.saver_def().restore_op_name(),
216 meta_graph_def_.saver_def().filename_tensor_name(),
217 asset_file_defs_, session, update_sparse,
218 latest_version, extra_tensors));
219
220 if (util::HasMainOp(meta_graph_def_)) {
221 return util::RunMainOp(*run_options_, savedmodel_dir,
222 meta_graph_def_, asset_file_defs_, session,
223 kSavedModelMainOpKey, sparse_storage_tensor_pair);
224 } else {
225 return util::RunMainOp(
226 *run_options_, savedmodel_dir, meta_graph_def_,
227 asset_file_defs_, session, kSavedModelLegacyInitOpKey,
228 sparse_storage_tensor_pair);
229 }
230}
231
232ModelSession::ModelSession(SessionGroup* s,
233 const std::string& select_session_policy,

Callers

nothing calls this directly

Calls 5

HasMainOpFunction · 0.85
RunMainOpFunction · 0.85
RunRestoreFunction · 0.70
TensorShapeClass · 0.50
emplace_backMethod · 0.45

Tested by

no test coverage detected