Modify snapshot graph dump to use hex filename for consistency with fingerprint folder names

PiperOrigin-RevId: 280327937
Change-Id: I13081cce921f6c668a163770ca9409a4e4848120
This commit is contained in:
Frank Chen 2019-11-13 18:40:33 -08:00 committed by TensorFlower Gardener
parent 9b94c27ef6
commit 213305f75c
2 changed files with 5 additions and 3 deletions

View File

@ -262,9 +262,11 @@ Status ReadMetadataFile(const string& hash_dir,
Status DumpDatasetGraph(const std::string& path, uint64 hash,
const GraphDef& graph) {
std::unique_ptr<WritableFile> file;
std::string graph_file = absl::StrCat(path, "/graph-", hash, ".pbtxt");
std::string hash_hex =
strings::StrCat(strings::Hex(hash, strings::kZeroPad16));
std::string graph_file = absl::StrCat(path, "/", hash_hex, "-graph.pbtxt");
LOG(INFO) << "Graph hash is " << hash << ", writing to " << graph_file;
LOG(INFO) << "Graph hash is " << hash_hex << ", writing to " << graph_file;
TF_RETURN_IF_ERROR(Env::Default()->RecursivelyCreateDir(path));
return WriteTextProto(Env::Default(), graph_file, graph);
}

View File

@ -62,7 +62,7 @@ class SnapshotDatasetTest(reader_dataset_ops_test_base.TFRecordDatasetTestBase,
# Ignore the graphdef pbtxts we write for debugging purposes.
for i in range(len(dirlist_raw)):
if not dirlist_raw[i].startswith("graph-"):
if not dirlist_raw[i].endswith("-graph.pbtxt"):
dirlist.append(dirlist_raw[i])
self.assertLen(dirlist, num_fingerprints)