diff options
author | Asim Shankar <ashankar@google.com> | 2018-10-08 09:49:38 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-10-08 09:54:04 -0700 |
commit | f435e776216c7a86f619a17064fd6e1deee638b3 (patch) | |
tree | 4be6e0a72ce9ee4b656502bc16f320d16c672833 /tensorflow/contrib | |
parent | 411b9baa39636030181fdff15d2e985824b03d61 (diff) |
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
Diffstat (limited to 'tensorflow/contrib')
-rw-r--r-- | tensorflow/contrib/distribute/python/parameter_server_strategy_test.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |