From e77dbdb2050de8cd0504b8484904858dfcd64c75 Mon Sep 17 00:00:00 2001 From: Alexandre Passos Date: Thu, 16 Aug 2018 11:24:42 -0700 Subject: Do not access .op and attrs of EagerTensor in mutex. PiperOrigin-RevId: 209016800 --- tensorflow/contrib/framework/python/ops/critical_section_ops.py | 5 +++-- 1 file 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. -- cgit v1.2.3