aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/distribute/python
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-06-12 09:51:04 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-12 09:56:39 -0700
commitb0a15f21d2009ead9c8ed5e245a02b5c42355853 (patch)
treec510b2d9996def66f345b2022120c49a89701a4c /tensorflow/contrib/distribute/python
parent3b4f4164663da4c65807c34e7188e43c9d7d7535 (diff)
Make the return value of `read_var` consistently a tensor instead of
sometimes a variable. PiperOrigin-RevId: 200231463
Diffstat (limited to 'tensorflow/contrib/distribute/python')
-rw-r--r--tensorflow/contrib/distribute/python/mirrored_strategy.py2
-rw-r--r--tensorflow/contrib/distribute/python/one_device_strategy.py2
2 files changed, 2 insertions, 2 deletions
diff --git a/tensorflow/contrib/distribute/python/mirrored_strategy.py b/tensorflow/contrib/distribute/python/mirrored_strategy.py
index 403e47d94f..900aa10e93 100644
--- a/tensorflow/contrib/distribute/python/mirrored_strategy.py
+++ b/tensorflow/contrib/distribute/python/mirrored_strategy.py
@@ -349,7 +349,7 @@ class MirroredStrategy(distribute_lib.DistributionStrategy):
if isinstance(tower_local_var, values.TowerLocalVariable):
return math_ops.add_n(self.unwrap(tower_local_var))
assert isinstance(tower_local_var, values.Mirrored)
- return tower_local_var.get()
+ return array_ops.identity(tower_local_var.get())
def _fetch(self, val, destination, fn):
"""Return a copy of `val` or `fn(val)` on `destination`."""
diff --git a/tensorflow/contrib/distribute/python/one_device_strategy.py b/tensorflow/contrib/distribute/python/one_device_strategy.py
index 6378af32bd..7f4bab9d93 100644
--- a/tensorflow/contrib/distribute/python/one_device_strategy.py
+++ b/tensorflow/contrib/distribute/python/one_device_strategy.py
@@ -104,7 +104,7 @@ class OneDeviceStrategy(distribute_lib.DistributionStrategy):
def read_var(self, tower_local_var):
"""Read the aggregate value of a tower-local variable."""
- return tower_local_var
+ return array_ops.identity(tower_local_var)
def _fetch(self, val, destination, fn):
"""Return a copy of `val` or `fn(val)` on `destination`."""