Main Content

addLayers

Add layers to layer graph

Description

example

newlgraph= addLayers(lgraph,larray)adds the network layers inlarray层图lgraph. The new layer graph,newlgraph, contains the layers and connections oflgraphtogether with the layers inlarray, connected sequentially. The layer names inlarraymust be unique, nonempty, and different from the names of the layers inlgraph.

Examples

collapse all

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

lgraph = layerGraph; layers = [ imageInputLayer([32 32 3],'Name',“输入”) convolution2dLayer(3,16,'Padding','same','Name','conv_1') batchNormalizationLayer('Name','BN_1') reluLayer('Name','relu_1')]; lgraph = addLayers(lgraph,layers); figure plot(lgraph)

Figure contains an axes object. The axes object contains an object of type graphplot.

Input Arguments

collapse all

Layer graph, specified as aLayerGraphobject. To create a layer graph, uselayerGraph.

Network layers, specified as aLayerarray.

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

Output Arguments

collapse all

Output layer graph, returned as aLayerGraphobject.

Version History

Introduced in R2017b