From 8815f34385eb28f1cfcb53bebd526c11573f3027 Mon Sep 17 00:00:00 2001 From: Gunhan Gulsoy Date: Mon, 8 Oct 2018 16:25:40 -0700 Subject: Avoid calling get_default_graph() during tf.enable_eager_execution() PiperOrigin-RevId: 216270497 --- tensorflow/python/framework/ops.py | 3 +-- 1 file changed, 1 insertion(+), 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.") -- cgit v1.2.3