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
This commit is contained in:
parent
806ccc2cf7
commit
e3d751c2a8
@ -923,6 +923,10 @@ def add_function(fdef):
|
|||||||
# but they do all import this file. Note that IS_IN_GRAPH_MODE and
|
# but they do all import this file. Note that IS_IN_GRAPH_MODE and
|
||||||
# in_graph_mode are both parameterless functions.
|
# in_graph_mode are both parameterless functions.
|
||||||
def _tmp_in_graph_mode():
|
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()
|
return not executing_eagerly()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user