Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions keras/src/backend/common/name_scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,17 @@ def __enter__(self):
return self

def __exit__(self, *args, **kwargs):
if self._pop_on_exit:
name_scope_stack = global_state.get_global_attribute(
"name_scope_stack"
)
if not self._pop_on_exit():
return
name_scope_stack = global_state.get_global_attribute(
"name_scope_stack"
)
if not name_scope_stack:
return
try:
name_scope_stack.pop()

except (AttributeError, IndexError):
return

def current_path():
name_scope_stack = global_state.get_global_attribute("name_scope_stack")
Expand Down
Loading