aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gunhan Gulsoy <gunan@google.com>2018-10-08 16:25:40 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-10-08 16:34:31 -0700
commit8815f34385eb28f1cfcb53bebd526c11573f3027 (patch)
treed6ab5db56e353efbaa00902ae2a6e2d7ee3575ec
parent46d296b2d03ddbb6f0723d213fdfa9c5226e1e2a (diff)
Avoid calling get_default_graph() during tf.enable_eager_execution()
PiperOrigin-RevId: 216270497
-rw-r--r--tensorflow/python/framework/ops.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/tensorflow/python/framework/ops.py b/tensorflow/python/framework/ops.py
index 77c2bc930e..140bd098a6 100644
--- a/tensorflow/python/framework/ops.py
+++ b/tensorflow/python/framework/ops.py
@@ -5457,8 +5457,7 @@ def enable_eager_execution_internal(config=None,
"tf.contrib.eager.ASYNC")
if context.default_execution_mode == context.GRAPH_MODE:
graph_mode_has_been_used = (
- _default_session_stack.stack
- or len(get_default_graph().get_operations()) > 0) # pylint: disable=g-explicit-length-test
+ _default_graph_stack._global_default_graph is not None) # pylint: disable=protected-access
if graph_mode_has_been_used:
raise ValueError(
"tf.enable_eager_execution must be called at program startup.")