MCPcopy Create free account
hub / github.com/Tencent/PhoenixGo / GetCheckpointPath

Function GetCheckpointPath

model/checkpoint_utils.cc:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25namespace fs = boost::filesystem;
26
27fs::path GetCheckpointPath(const fs::path &train_dir)
28{
29 tensorflow::CheckpointState checkpoint_state;
30 fs::path ckpt_state_path = train_dir / "checkpoint";
31 std::ostringstream ckpt_ss;
32 if (!(ckpt_ss << std::ifstream(ckpt_state_path.string()).rdbuf())) {
33 PLOG(ERROR) << "Error reading " << ckpt_state_path;
34 return "";
35 }
36 if (!google::protobuf::TextFormat::ParseFromString(ckpt_ss.str(), &checkpoint_state)) {
37 LOG(ERROR) << "Error parsing " << ckpt_state_path << ", buf=" << ckpt_ss.str();
38 return "";
39 }
40 fs::path checkpoint_path = checkpoint_state.model_checkpoint_path();
41 if (checkpoint_path.is_relative()) {
42 checkpoint_path = train_dir / checkpoint_path;
43 }
44 return checkpoint_path;
45}
46
47bool CopyCheckpoint(const fs::path &from, const fs::path &to)
48{

Callers 2

CopyCheckpointFunction · 0.85
InitMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected