aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/distribute/python/values.py
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/distribute/python/values.py')
-rw-r--r--tensorflow/contrib/distribute/python/values.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/contrib/distribute/python/values.py b/tensorflow/contrib/distribute/python/values.py
index 49b4e24daa..9572ade8e4 100644
--- a/tensorflow/contrib/distribute/python/values.py
+++ b/tensorflow/contrib/distribute/python/values.py
@@ -65,9 +65,10 @@ class DistributedValues(object):
device = device_util.canonicalize(device)
try:
return self._index[device]
- except KeyError:
- raise ValueError("Device %s not found in %s (current device %s)" %
- (device, self._index.keys(), device_util.current()))
+ except KeyError as e:
+ six.raise_from(
+ ValueError("Device %s not found in %s (current device %s)" %
+ (device, self._index.keys(), device_util.current())), e)
def on_device(self, device):
device = device_util.canonicalize(device)