Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify calls to .executing_eagerly() #40798

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tensorflow/python/eager/backprop.py
Expand Up @@ -699,7 +699,7 @@ def _ones(shape, dtype):
if as_dtype == dtypes.string:
return None

if not context.context().executing_eagerly():
if not context.executing_eagerly():
return array_ops.ones(shape, dtype)

if as_dtype.is_bool:
Expand Down
4 changes: 1 addition & 3 deletions tensorflow/python/framework/ops.py
Expand Up @@ -6411,9 +6411,7 @@ def name_scope(name, default_name=None, values=None, skip_on_eager=True):
Returns:
`name_scope*` context manager.
"""
ctx = context.context()
in_eager_mode = ctx.executing_eagerly()
if not in_eager_mode:
if not context.executing_eagerly():
return internal_name_scope_v1(name, default_name, values)

if skip_on_eager:
Expand Down
4 changes: 2 additions & 2 deletions tensorflow/python/ops/summary_ops_v2.py
Expand Up @@ -1186,7 +1186,7 @@ def trace_on(graph=True, profiler=False): # pylint: disable=redefined-outer-nam
if ops.inside_function():
logging.warn("Cannot enable trace inside a tf.function.")
return
if not context.context().executing_eagerly():
if not context.executing_eagerly():
logging.warn("Must enable trace in eager mode.")
return

Expand Down Expand Up @@ -1231,7 +1231,7 @@ def trace_export(name, step=None, profiler_outdir=None):
if ops.inside_function():
logging.warn("Cannot export trace inside a tf.function.")
return
if not context.context().executing_eagerly():
if not context.executing_eagerly():
logging.warn("Can only export trace while executing eagerly.")
return

Expand Down