| 49 | REGISTER_OP("UncompilableUnary").Input("a: float").Output("o: float"); |
| 50 | |
| 51 | std::unordered_map<string, string> GetClusters(const Graph& graph) { |
| 52 | std::unordered_map<string, string> ids; |
| 53 | for (Node* node : graph.nodes()) { |
| 54 | string cluster; |
| 55 | if (TryGetNodeAttr(node->attrs(), kXlaClusterAttr, &cluster)) { |
| 56 | CHECK(!cluster.empty()); |
| 57 | ids[node->name()] = cluster; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | if (VLOG_IS_ON(2)) { |
| 62 | VLOG(2) << "Clusters:"; |
| 63 | for (const auto& p : ids) { |
| 64 | VLOG(2) << " " << p.first << " -> " << p.second; |
| 65 | } |
| 66 | } |
| 67 | return ids; |
| 68 | } |
| 69 | |
| 70 | absl::flat_hash_map<string, std::vector<string>> GetClusterSets( |
| 71 | const Graph& g, std::vector<string>* cluster_names = nullptr) { |