From 2b78c2d76dfde9b54e1e57ee12b3d1e65283d74c Mon Sep 17 00:00:00 2001
From: Michael Gester <mgester@google.com>
Date: Wed, 30 Dec 2020 14:55:04 -0800
Subject: [PATCH] Fixed misleading error message

This error can happen for both reference and resource edges.

PiperOrigin-RevId: 349605354
Change-Id: I8442af8b8a8823d199ab39744c9d0ccd125b30bb
---
 tensorflow/core/common_runtime/colocation_graph.cc | 10 +++++-----
 tensorflow/core/common_runtime/placer_test.cc      |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tensorflow/core/common_runtime/colocation_graph.cc b/tensorflow/core/common_runtime/colocation_graph.cc
index 962db699d1f..8c364d637fe 100644
--- a/tensorflow/core/common_runtime/colocation_graph.cc
+++ b/tensorflow/core/common_runtime/colocation_graph.cc
@@ -702,11 +702,11 @@ Status ColocationGraph::ColocateResourceOrRefEdge(const Node* src,
   Status status = ColocateNodes(*src, src_root_id, *dst, dst_root_id);
   if (!status.ok()) {
     return AttachDef(
-        errors::InvalidArgument("Nodes were connected by a "
-                                "reference connection (requiring them to "
-                                "be on the same device), but the two nodes "
-                                "were assigned two different devices: ",
-                                status.error_message()),
+        errors::InvalidArgument(
+            "Nodes were connected by a reference or resource connection "
+            "(requiring them to be on the same device), but the two nodes "
+            "were assigned two different devices: ",
+            status.error_message()),
         *dst);
   }
   return Status::OK();
diff --git a/tensorflow/core/common_runtime/placer_test.cc b/tensorflow/core/common_runtime/placer_test.cc
index e0e887e7d66..8960a91bde5 100644
--- a/tensorflow/core/common_runtime/placer_test.cc
+++ b/tensorflow/core/common_runtime/placer_test.cc
@@ -2972,9 +2972,9 @@ TEST_F(NestedPlacerTest, NestedTwoFunctionsBackToBack) {
   EXPECT_EQ(error::INVALID_ARGUMENT, s.code()) << s.ToString();
   EXPECT_TRUE(absl::StrContains(
       s.error_message(),
-      "Nodes were connected by a reference connection (requiring them to be on "
-      "the same device), but the two nodes were assigned two different "
-      "devices"))
+      "Nodes were connected by a reference or resource connection (requiring "
+      "them to be on the same device), but the two nodes were assigned two "
+      "different devices"))
       << s.ToString();
 }