layerGraph
R2026b(Not recommended) Graph of network layers for deep learning
LayerGraph objects are not recommended. Use dlnetwork objects instead. For more
information, see Version History.
To learn more about how to transition
trainNetwork, SeriesNetwork, and
DAGNetwork code to dlnetwork workflows, see Transition trainNetwork, SeriesNetwork, and DAGNetwork Code to dlnetwork Workflows.
Description
A layer graph specifies the architecture of a neural network as a directed acyclic graph (DAG) of deep learning layers. The layers can have multiple inputs and multiple outputs.
Creation
Description
creates an empty
layer graph that contains no layers. You can add layers to the empty graph by
using the lgraph = layerGraphaddLayers function.
creates a layer graph from an array of network layers and sets the lgraph = layerGraph(layers)Layers property. The layers in
lgraph are connected in the same sequential order as in
layers.
extracts the layer graph of a lgraph = layerGraph(net)SeriesNetwork,
DAGNetwork, or dlnetwork object. For
example, you can extract the layer graph of a pretrained network to perform
transfer learning.
Input Arguments
Properties
Object Functions
addLayers | Add layers to neural network |
removeLayers | Remove layers from neural network |
replaceLayer | Replace layer in neural network |
connectLayers | Connect layers in neural network |
disconnectLayers | Disconnect layers in neural network |
plot | Plot neural network architecture |
Examples
Limitations
Layer graph objects contain no quantization information. Extracting the layer graph from a quantized network and then reassembling the network using
assembleNetworkordlnetworkremoves quantization information from the network.
Version History
Introduced in R2017bSee Also
imagePretrainedNetwork | dlnetwork | trainingOptions | trainnet | dag2dlnetwork | addLayers | removeLayers | connectLayers | disconnectLayers | plot | additionLayer | replaceLayer | depthConcatenationLayer | analyzeNetwork | Deep Network
Designer
Topics
- Create Simple Deep Learning Neural Network for Classification
- Train Residual Network for Image Classification
- Retrain Neural Network to Classify New Images
- Transition trainNetwork, SeriesNetwork, and DAGNetwork Code to dlnetwork Workflows
- Deep Learning in MATLAB
- Pretrained Deep Neural Networks
- List of Deep Learning Layers


