Main Content

disconnectLayers

Disconnect layers in layer graph

Description

example

newlgraph= disconnectLayers(lgraph,s,d)disconnects the source layersfrom the destination layerdin the layer graphlgraph. The new layer graph,newlgraph, contains the same layers aslgraph, but excludes the connection betweensandd.

Examples

collapse all

Create a layer graph from an array of layers.

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

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

Disconnect the'conv_1'layer from the'BN_1'layer.

lgraph = disconnectLayers(lgraph,'conv_1','BN_1'); 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.

Connection source, specified as a character vector or a string scalar.

  • If the source layer has a single output, thensis the name of the layer.

  • If the source layer has multiple outputs, thensis the layer name followed by the character / and the name of the layer output:'layerName/outputName'.

Example:'conv1'

Example:'mpool/indices'

Connection destination, specified as a character vector or a string scalar.

  • If the destination layer has a single input, thendis the name of the layer.

  • If the destination layer has multiple inputs, thendis the layer name followed by the character / and the name of the layer input:'layerName/inputName'.

Example:'fc'

Example:'addlayer1/in2'

Output Arguments

collapse all

Output layer graph, returned as aLayerGraphobject.

版本History

Introduced in R2017b