tensorflow/core/grappler/graph_analyzer/test_tools.cc
//=== Helper methods for analysing the structures.
Helper methods for analysing the structures.
Helper methods for analysing the structures .
std::vector<string> DumpLinkMap(const GenNode::LinkMap& link_map) {
  std::map<string, string> ordered;
  for (const auto& link : link_map) {
    string key = string(link.first);
    std::multiset<string> others;
    for (const auto& other : link.second) {
      others.emplace(
          absl::StrFormat("%s[%s]", other.node->name(), string(other.port)));
    }
    ordered[key] = absl::StrJoin(others, ", ");
  }
  std::vector<string> result;
  result.reserve(ordered.size());
  for (const auto& link : ordered) {
    result.emplace_back(link.first + ": " + link.second);
  }
  return result;
}
std :: vector < string > DumpLinkMap ( const GenNode :: LinkMap & link_map ) { std :: map < string , string > ordered ; for ( const auto & link : link_map ) { string key = string ( link . first ) ; std :: multiset < string > others ; for ( const auto & other : link . second ) { others . emplace ( absl :: StrFormat ( " " , other . node -> name ( ) , string ( other . port ) ) ) ; } ordered [ key ] = absl :: StrJoin ( others , " " ) ; } std :: vector < string > result ; result . reserve ( ordered . size ( ) ) ; for ( const auto & link : ordered ) { result . emplace_back ( link . first + " " + link . second ) ; } return result ; }
Helper methods for analysing the structures.
Helper methods for analysing the structures .
// This will order the entries first. // Order the other sides too. They may be repeating, so store them // in a multiset. // Now dump the result in a predictable order.