The graph is data you can read
Because a Functional model is a static DAG rather than imperative code, the graph is a first-class object you can inspect and debug — no need to run a forward pass to find out what your model actually built. The Code block shows the three tools you'll reach for, in increasing power:
model.summary()— the text table: every layer, its output shape, and parameter count. Fastest sanity check; catches the classic 'wait, why is this shape (None, 1)?' bugs.keras.utils.plot_model(...)— renders the actual DAG as an image, with shapes on the edges. This is where branches and skips become legible in a way text never will be.- Intermediate-output models — the power move: build a throwaway
keras.Modelfrommodel.inputto any inner layer's.outputand callpredicton it. You get the activations at that point in the graph, which is how you debug 'where did the values go NaN?' without touching the original model.
The gotcha
plot_model isn't pure Python — it shells out to Graphviz via the pydot package. If you only pip install keras, the call fails with a cryptic 'failed to import pydot' error. Install both (pip install pydot and the system Graphviz binary) before you rely on it, especially in a fresh container or CI.