aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Alexandre Passos <apassos@google.com>2018-08-16 11:24:42 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-16 11:57:55 -0700
commite77dbdb2050de8cd0504b8484904858dfcd64c75 (patch)
tree17b26e8080fee5522ee672682f07c4ed62803356
parent020ce87723b43f96372fff79c1b8d9f989286409 (diff)
Do not access .op and attrs of EagerTensor in mutex.
PiperOrigin-RevId: 209016800
-rw-r--r--tensorflow/contrib/framework/python/ops/critical_section_ops.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tensorflow/contrib/framework/python/ops/critical_section_ops.py b/tensorflow/contrib/framework/python/ops/critical_section_ops.py
index 72835c3ad8..71ab755aa2 100644
--- a/tensorflow/contrib/framework/python/ops/critical_section_ops.py
+++ b/tensorflow/contrib/framework/python/ops/critical_section_ops.py
@@ -325,6 +325,8 @@ class CriticalSection(object):
def _is_self_handle(self, x):
"""Check if the tensor `x` is the same Mutex as `self._handle`."""
+ if isinstance(x, ops.EagerTensor):
+ return x is self._handle
return (x.op.type == "MutexV2"
# blank shared_name means the op will create a unique one.
and x.op.get_attr("shared_name")
@@ -365,8 +367,7 @@ class CriticalSection(object):
"(CriticalSection: %s) requested exclusive resource access "
"of this resource. Did you mean to call execute with keyword "
"argument exclusive_resource_access=False?" %
- (list(resource_intersection), self._handle.name,
- sg.op.name, sg.handle.name))
+ (list(resource_intersection), self._handle, sg, sg.handle))
# TODO(ebrevdo): Re-enable once CriticalSection is in core.