From b0a15f21d2009ead9c8ed5e245a02b5c42355853 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Tue, 12 Jun 2018 09:51:04 -0700 Subject: Make the return value of `read_var` consistently a tensor instead of sometimes a variable. PiperOrigin-RevId: 200231463 --- tensorflow/contrib/distribute/python/mirrored_strategy.py | 2 +- tensorflow/contrib/distribute/python/one_device_strategy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'tensorflow/contrib/distribute') 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`.""" -- cgit v1.2.3