addLayers

Add layers to layer graph

Syntax

newlgraph = addLayers(lgraph,larray)

Description

example

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.

Examples

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')  
    convolution2dLayer(3,16,'Padding','same','Name','conv_1')
    batchNormalizationLayer('Name','BN_1')
    reluLayer('Name','relu_1')];

lgraph = addLayers(lgraph,layers);
figure
plot(lgraph)

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