From f435e776216c7a86f619a17064fd6e1deee638b3 Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Mon, 8 Oct 2018 09:49:38 -0700 Subject: Avoid adding spurious ops when colocating with resource variables. Prior to this change, tf.colocate_with(v) would insert spurious operations (a ReadVariableOp and an Identity) in the graph when v is a resource variable, and then colocate the operations within the block with those newly added, otherwise disconnected, operations. This commit avoids adding the unnecessary ReadVariableOp/Identity nodes and colocates operations within the block with the VarHandleOp. PiperOrigin-RevId: 216201638 --- .../contrib/distribute/python/parameter_server_strategy_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tensorflow/contrib') diff --git a/tensorflow/contrib/distribute/python/parameter_server_strategy_test.py b/tensorflow/contrib/distribute/python/parameter_server_strategy_test.py index 353d11a583..9c112e4f85 100644 --- a/tensorflow/contrib/distribute/python/parameter_server_strategy_test.py +++ b/tensorflow/contrib/distribute/python/parameter_server_strategy_test.py @@ -262,7 +262,9 @@ class ParameterServerStrategyTestBase( h = f + 1.0 self.assertEqual( device_util.canonicalize(u.device), tower_variable_device) - self.assertEqual(device_util.canonicalize(x.device), h.device) + self.assertEqual( + device_util.canonicalize(x.device), + device_util.canonicalize(h.device)) return y_add, z_add, f y, z, f = d.call_for_each_tower(model_fn) -- cgit v1.2.3