Fix loading of single-input/output models (closes #461) - #463
Merged
Conversation
Keras serializes a single connection in input_layers/output_layers as a flat ["layer", node_idx, tensor_idx], but multiple connections as a list of such triples. The previous code used create_vector for both, which iterated each element of the flat form and tried to parse a string/int as an inbound node, failing with "invalid format for inbound node" - the exact error from the README example. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Newer Keras versions serialize a single input/output as a flat triple ["layer", node_idx, tensor_idx] instead of a list containing one such triple. The existing readme_example_main test exercises a single-input model, but only catches this when CI runs against a Keras version that already emits the flat form. Post-process the readme example JSON into flat form and load it from a new test so this code path is covered on any Keras version. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the JSON post-processing helper and its test. Coverage will instead come from a follow-up CI bump to a Keras version that natively emits the flat input_layers/output_layers form, at which point the existing readme_example_main test exercises this code path against real Keras output. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Error: invalid format for inbound node(issue The example from the README fails #461).input_layers/output_layersas a flat["layer", node_idx, tensor_idx]and multiple connections as a list of such triples. The previous code usedcreate_vectorfor both, which iterated each element of the flat form and tried to parse a string/int as an inbound node.Test plan
invalid format for inbound node.🤖 Generated with Claude Code