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.

disconnectLayers

Disconnect layers in layer graph

Syntax

newlgraph = disconnectLayers(lgraph,s,d)

Description

example

newlgraph = disconnectLayers(lgraph,s,d) disconnects the source layer s from the destination layer d in the layer graph lgraph. The new layer graph, newlgraph, contains the same layers as lgraph, but excludes the connection between s and d.

Examples

collapse all

Create a layer graph from an array of layers.

layers = [
    imageInputLayer([28 28 1],'Name','input')  
    convolution2dLayer(3,16,'Padding','same','Name','conv_1')
    batchNormalizationLayer('Name','BN_1')
    reluLayer('Name','relu_1')];

lgraph = layerGraph(layers);
figure
plot(lgraph)

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

lgraph = disconnectLayers(lgraph,'conv_1','BN_1');
figure
plot(lgraph)

Input Arguments

collapse all

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

Connection source, specified as a character vector.

  • If the source layer has a single output, then s is the name of the layer.

  • If the source layer has multiple outputs, then s is 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.

  • If the destination layer has a single input, then d is the name of the layer.

  • If the destination layer has multiple inputs, then d is 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 a LayerGraph object.

Introduced in R2017b