Add node name to placer device-placement/kernel-assignment error messages .
authorA. Unique TensorFlower <gardener@tensorflow.org>
Thu, 22 Feb 2018 16:52:42 +0000 (08:52 -0800)
committerTensorFlower Gardener <gardener@tensorflow.org>
Thu, 22 Feb 2018 16:56:46 +0000 (08:56 -0800)
PiperOrigin-RevId: 186622923

tensorflow/core/common_runtime/placer.cc

index a913f2075181a3896015579d79093395d67101ff..e128b9257f2369e25c911f9a9e1d08475706d561 100644 (file)
@@ -464,6 +464,7 @@ class ColocationGraph {
     // the user can see why an unsatisfiable placement occurred.
 
     std::unordered_map<string, string> type_to_devices;
+    std::vector<const Node*> colocation_nodes;
     int num_nodes_found = 0;
 
     for (const Node* node : graph_->nodes()) {
@@ -475,6 +476,7 @@ class ColocationGraph {
         continue;
       }
       ++num_nodes_found;
+      colocation_nodes.push_back(node);
       const string& op_type = node->type_string();
       string devices_registered;
       for (const auto& device_type : members_[id].supported_device_types) {
@@ -488,6 +490,13 @@ class ColocationGraph {
     for (const auto& td : type_to_devices) {
       strings::StrAppend(&text, "\n", td.first, ": ", td.second);
     }
+    strings::StrAppend(&text,
+                       "\n\nColocation members and user-requested devices:");
+    for (const Node* node : colocation_nodes) {
+      strings::StrAppend(&text, "\n  ", node->name(), " (", node->type_string(),
+                         ") ", node->requested_device());
+    }
+    strings::StrAppend(&text, "\n");
 
     if (num_nodes_found <= 1) {
       text.clear();