提交 e3d751c2 编写于 作者: S Sergei Lebedev 提交者: TensorFlower Gardener

IS_IN_GRAPH_MODE should not force-init the eager context.

This caused hard to diagnose failures in enable_eager_execution calls.

PiperOrigin-RevId: 225050519
上级 806ccc2c
......@@ -923,6 +923,10 @@ def add_function(fdef):
# but they do all import this file. Note that IS_IN_GRAPH_MODE and
# in_graph_mode are both parameterless functions.
def _tmp_in_graph_mode():
if context_safe() is None:
# Context not yet initialized. Assume graph mode following the
# default implementation in `is_in_graph_mode`.
return True
return not executing_eagerly()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册