diff options
author | 2018-03-07 12:03:56 -0800 | |
---|---|---|
committer | 2018-03-07 12:10:42 -0800 | |
commit | 37cef895bfe06913477b87917cbee7284aefa7cd (patch) | |
tree | 4f05a013578c0459a52fc5e6448bb3dfc2d04971 /tensorflow/contrib/framework | |
parent | 808b569e85df8d63590740f05bc14d964efc4801 (diff) |
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
Diffstat (limited to 'tensorflow/contrib/framework')
-rw-r--r-- | tensorflow/contrib/framework/python/ops/critical_section_ops.py | 8 |
1 files changed, 4 insertions, 4 deletions
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, |