liveBook · Manning

Layer connectivity

As explained in Deep Learning with R, Third Edition

Layer connectivity is the pattern of directed connections linking neural-network layers and their input or output nodes.

Layer connectivity is the directed graph linking neural-network inputs, layer outputs, and final outputs. In Keras, the Functional API makes this graph explicit, so models can contain branches, multiple inputs, and multiple outputs. section 7.2.2

A small connected graph

Create an input, pass it through two Dense layers, and declare the input and output tensors as a model: inputs <- keras_input(shape = c(3), name = "my_input"); features <- inputs |> layer_dense(64, activation = "relu"); outputs <- features |> layer_dense(10, activation = "softmax"); model <- keras_model(inputs = inputs, outputs = outputs). section 7.2.2

Use explicit connectivity to:

  • Plot model topology, optionally showing layer names and tensor shapes. section 7.2.2
  • Inspect each layer’s input and output tensors through model$layers. section 7.2.2
  • Reuse intermediate outputs for feature extraction or additional prediction heads. section 7.2.2
Listing 7.8 A simple Functional model with two Dense layers
inputs <- keras_input(shape = c(3), name = "my_input")
features <- inputs |> layer_dense(64, activation = "relu")
outputs <- features |> layer_dense(10, activation = "softmax")
model <- keras_model(inputs = inputs, outputs = outputs,
                     name = "my_functional_model")

Inspect a complete two-layer Functional model and its declared input-output graph. section 7.2.2

How Deep Learning with R, Third Edition covers it

How deep it goes
Explains explicit graph structure, tensor inspection, visualization, and intermediate reuse, but does not detail graph execution internals.
Examples
Uses two Dense layers, a multi-input ticket classifier, plotted topologies, and an added difficulty output from shared features.
What it assumes
Assumes basic Keras model-building familiarity while showing inputs, tensors, layers, and model declarations concretely.
What you can do after
Build and inspect Functional models, plot their topology, and create new models from intermediate layer outputs.
How it connects
Connects the Functional API with model visualization, feature extraction, multi-input models, and model subclassing.

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with R, Third Edition. The section links point to the parts of the book it draws on.