Main Content

plot

Plot neural network layer graph

Description

example

plot(lgraph)plots a diagram of the layer graphlgraph. Theplotfunction labels each layer by its name and displays all layer connections.

Tip

To create an interactive network visualization and analyze the network architecture, usedeepNetworkDesigner(lgraph). For more information, seeDeep Network Designer.

example

plot(net)plots a diagram of the networknet.

Examples

collapse all

Create a layer graph from an array of layers. Connect the'relu_1'layer to the'add'layer.

layers = [ imageInputLayer([32 32 3],'Name','input') convolution2dLayer(3,16,'Padding','same','Name','conv_1') batchNormalizationLayer('Name','BN_1') reluLayer('Name','relu_1') convolution2dLayer(3,16,'Padding','same','Stride',2,'Name','conv_2') batchNormalizationLayer('Name','BN_2') reluLayer('Name','relu_2') additionLayer(2,'Name','add')]; lgraph = layerGraph(layers); lgraph = connectLayers(lgraph,'relu_1','add/in2');

Plot the layer graph.

figure plot(lgraph);

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

Load a pretrained GoogLeNet convolutional neural network as aDAGNetworkobject. If the Deep Learning Toolbox™ Modelfor GoogLeNet Networksupport package is not installed, then the software provides a download link.

net = googlenet
net = DAGNetwork with properties: Layers: [144×1 nnet.cnn.layer.Layer] Connections: [170×2 table]

Plot the network.

figure('Units','normalized','Position',[0.1 0.1 0.8 0.8]); plot(net)

Load a pretrained AlexNet convolutional neural network as aSeriesNetworkobject. If the Deep Learning Toolbox™ Modelfor AlexNet Networksupport package is not installed, then the software provides a download link.

net = alexnet
net = SeriesNetwork with properties: Layers: [25x1 nnet.cnn.layer.Layer] InputNames: {'data'} OutputNames: {'output'}

Plot the network.

plot(net)

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 architecture, specified as aSeriesNetworkor aDAGNetworkobject.

Version History

Introduced in R2017b