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

Function DumpLinkMap

tensorflow/core/grappler/graph_analyzer/test_tools.cc:81–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79//=== Helper methods for analysing the structures.
80
81std::vector<string> DumpLinkMap(const GenNode::LinkMap& link_map) {
82 // This will order the entries first.
83 std::map<string, string> ordered;
84 for (const auto& link : link_map) {
85 string key = string(link.first);
86
87 // Order the other sides too. They may be repeating, so store them
88 // in a multiset.
89 std::multiset<string> others;
90 for (const auto& other : link.second) {
91 others.emplace(
92 absl::StrFormat("%s[%s]", other.node->name(), string(other.port)));
93 }
94 ordered[key] = absl::StrJoin(others, ", ");
95 }
96 // Now dump the result in a predictable order.
97 std::vector<string> result;
98 result.reserve(ordered.size());
99 for (const auto& link : ordered) {
100 result.emplace_back(link.first + ": " + link.second);
101 }
102 return result;
103}
104
105std::vector<string> DumpLinkHashMap(const SigNode::LinkHashMap& link_hash_map) {
106 // The entries in this map are ordered by hash value which might change

Callers 1

TESTFunction · 0.85

Calls 5

nameMethod · 0.65
emplaceMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected