tf.compat.v1.executing_eagerly_outside_functions
Stay organized with collections
Save and categorize content based on your preferences.
Returns True if executing eagerly, even if inside a graph function.
tf.compat.v1.executing_eagerly_outside_functions()
This function will check the outermost context for the program and see if
it is in eager mode. It is useful comparing to tf.executing_eagerly()
,
which checks the current context and will return False
within a
tf.function
body. It can be used to build library that behave differently
in eager runtime and v1 session runtime (deprecated).
Example:
tf.compat.v1.enable_eager_execution()
@tf.function
def func():
# A function constructs TensorFlow graphs, it does not execute eagerly,
# but the outer most context is still eager.
assert not tf.executing_eagerly()
return tf.compat.v1.executing_eagerly_outside_functions()
func()
<tf.Tensor: shape=(), dtype=bool, numpy=True>
Returns |
boolean, whether the outermost context is in eager mode.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-03-23 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2023-03-23 UTC."],[],[]]