Skip to content

Commit f98b91f

Browse files
authored
Bug fixes in plot_model with nested models. (#21243)
There were several issues with `keras.utils.plot_model()` / `keras.utils.model_to_dot()` when rendering nested models with `expand_nested=True`: - Sequential models were not expanded - Edges going into nested models would always connect to the first box in the subgraph, which is incorrect because: - Functional models can have multiple inputs and the edge needs to point to the correct input - The destination of the edge can be further nested sub-models like Sequential sub-models - Edges going out of nested models would always connect from the last box in the subgraph, which is incorrect because: - Functional models can have multiple outputs and the edge needs to come from the correct layer - The source of the edge can be further nested in sub-models since there is no "output" box This adds to the integration tests. In particular, it augments the way the topology is verified: - it provides detailed message for dangling edges - it can inspected nested subgraphs - it verifies there are no extra edges that the ones expected - it can verify splits in the graph Visual tests: https://colab.research.google.com/gist/hertschuh/fb7dfdbf4fb31139e33e750ab10aaad4/plot_model-testing.ipynb Fixes #21119
1 parent d8f3f70 commit f98b91f

File tree

2 files changed

+771
-470
lines changed

2 files changed

+771
-470
lines changed

0 commit comments

Comments
 (0)