This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Add layers to layer graph


newlgraph = addLayers(lgraph,larray)



newlgraph = addLayers(lgraph,larray) adds the network layers in larray to the layer graph lgraph. The new layer graph, newlgraph, contains the layers and connections of lgraph together with the layers in larray, connected sequentially. The layer names in larray must be unique, nonempty, and different from the names of the layers in lgraph.


collapse all

Create an empty layer graph and an array of layers. Add the layers to the layer graph and plot the graph. addLayers connects the layers sequentially.

lgraph = layerGraph;

layers = [
    imageInputLayer([32 32 3],'Name','input')  

lgraph = addLayers(lgraph,layers);

Input Arguments

collapse all

Layer graph, specified as a LayerGraph object. To create a layer graph, use layerGraph.

Network layers, specified as a Layer array.

For a list of built-in layers, see List of Deep Learning Layers.

Output Arguments

collapse all

Output layer graph, returned as a LayerGraph object.

Introduced in R2017b