Skip to content

[Bug] name_scope_stack causing exceptions #21831

@JimiC

Description

@JimiC

Hi, I'm currently building a tool for an EU research project and I came across a bug with name_scope_stack.

I'm getting two different errors when calling predict or when calling load_model,

...
.../.venv/lib/python3.12/site-packages/keras/src/backend/common/name_scope.py", line 61, in __exit__
    name_scope_stack.pop()
    ^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'pop'

or

 .../.venv/lib/python3.12/site-packages/keras/src/backend/common/name_scope.py", line 61, in __exit__
    name_scope_stack.pop()
IndexError: pop from empty list

If I manually add a guard clause to handle the case of name_scope_stack being None or name_scope_stack being empty, my code executes fine.
Any chance you could add those guards, so we can move forward with our project?

Thanks in advance.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions