Skip to content

Avoid failing directly when parsng Keras 2 layers #6826

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

Merged
merged 1 commit into from
Apr 10, 2024
Merged
Changes from all commits
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
5 changes: 5 additions & 0 deletions tensorboard/plugins/graph/keras_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ def _get_inbound_nodes(layer):
inbound_nodes = []
if layer.get("inbound_nodes") is not None:
for maybe_inbound_node in layer.get("inbound_nodes", []):
if not isinstance(maybe_inbound_node, dict):
# Note that the inbound node parsing is not backward compatible with
# Keras 2. If given a Keras 2 model, the input nodes will be missing
# in the final graph.
continue
for inbound_node_args in maybe_inbound_node.get("args", []):
# Sometimes this field is a list when there are multiple inbound nodes
# for the given layer.
Expand Down