Skip to content

Commit

Permalink
RF is_executing_eagerly
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Mar 11, 2024
1 parent 7bbfab0 commit 870826b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions returnn/frontend/_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,6 +1329,13 @@ def get_selected_backend() -> Optional[str]:
return global_backend.__class__.name


def is_executing_eagerly() -> bool:
"""
:return: whether the current selected backend is executing eagerly
"""
return global_backend.executing_eagerly()


def select_backend_tf():
"""
Selects the RETURNN layers backend (based on TF).
Expand Down
9 changes: 8 additions & 1 deletion returnn/frontend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,20 @@
from . import _backend

# And some functions from the internal backend API.
from ._backend import select_backend, get_selected_backend, select_backend_torch, select_backend_returnn_layers_tf
from ._backend import (
select_backend,
get_selected_backend,
select_backend_torch,
select_backend_returnn_layers_tf,
is_executing_eagerly,
)

__all__ = [
"select_backend",
"get_selected_backend",
"select_backend_torch",
"select_backend_returnn_layers_tf",
"is_executing_eagerly",
"is_backend_raw_tensor_dim_tag_independent",
]

Expand Down

0 comments on commit 870826b

Please sign in to comment.