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

Function MakeUniqueFilename

tensorflow/core/util/dump_graph.cc:37–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35};
36
37string MakeUniqueFilename(string name) {
38 static NameCounts& instance = *new NameCounts;
39
40 // Remove illegal characters from `name`.
41 for (int i = 0; i < name.size(); ++i) {
42 char ch = name[i];
43 if (ch == '/' || ch == '[' || ch == ']' || ch == '*' || ch == '?' ||
44 ch == '\\') {
45 name[i] = '_';
46 }
47 }
48
49 int count;
50 {
51 mutex_lock lock(instance.counts_mutex);
52 count = instance.counts[name]++;
53 }
54
55 string filename = name;
56 if (count > 0) {
57 absl::StrAppend(&filename, "_", count);
58 }
59 absl::StrAppend(&filename, ".pbtxt");
60 return filename;
61}
62
63#if defined(TENSORFLOW_LITE_PROTOS)
64Status WriteToFile(const string& filepath,

Callers 1

Calls 2

StrAppendFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected