From 37cef895bfe06913477b87917cbee7284aefa7cd Mon Sep 17 00:00:00 2001 From: Asim Shankar Date: Wed, 7 Mar 2018 12:03:56 -0800 Subject: eager: Rename in_eager_mode to executing_eagerly and get rid of in_graph_mode. This is in preparation to introduce one public, stable symbol: tf.executing_eagerly() (i.e., part of moving APIs related to eager execution from "contrib" to a namespace where we provide API stability guarantees) PiperOrigin-RevId: 188212646 --- tensorflow/contrib/framework/python/ops/critical_section_ops.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tensorflow/contrib/framework') diff --git a/tensorflow/contrib/framework/python/ops/critical_section_ops.py b/tensorflow/contrib/framework/python/ops/critical_section_ops.py index ab603cc18e..cc19372acf 100644 --- a/tensorflow/contrib/framework/python/ops/critical_section_ops.py +++ b/tensorflow/contrib/framework/python/ops/critical_section_ops.py @@ -154,7 +154,7 @@ class CriticalSection(object): self._handle = gen_resource_variable_ops.mutex_v2( shared_name=shared_name, container=container, name=name) - if context.in_graph_mode(): + if not context.executing_eagerly(): ops.add_to_collections(CRITICAL_SECTIONS, self) @property @@ -221,7 +221,7 @@ class CriticalSection(object): "This is illegal and would cause deadlocks. " "CriticalSection: %s." % self._handle) - if context.in_graph_mode(): + if not context.executing_eagerly(): # Collections and op introspection does not work in eager # mode. This is generally ok; since eager mode (as of # writing) executes sequentially anyway. @@ -250,7 +250,7 @@ class CriticalSection(object): return x.identity() elif isinstance(x, ops.Operation): return control_flow_ops.group(x) - elif context.in_eager_mode() and x is None: + elif context.executing_eagerly() and x is None: return None else: return array_ops.identity(x) @@ -274,7 +274,7 @@ class CriticalSection(object): with ops.control_dependencies([ensure_lock_exists]): outputs = nest.map_structure(identity, r) - if context.in_graph_mode(): + if not context.executing_eagerly(): signature = _ExecutionSignature( op=lock.op, handle=self._handle, -- cgit v1.2.3