主要内容

disconnectLayers

在神经网络中断开层连接

说明

netUpdated = disconnectLayers(net,s,d) 断开源层 sdlnetwork 对象 net 中的目标层 d 的连接。更新后的网络 netUpdated 包含与 net 相同的层,但不包括 sd 之间的连接。

示例

示例

全部折叠

创建一个简单的神经网络并将其在图中显示。

net = dlnetwork;

layers = [
    imageInputLayer([28 28 1])  
    convolution2dLayer(3,16,Padding="same")
    batchNormalizationLayer
    reluLayer];

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

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

断开名为 "conv""batchnorm" 的层之间的连接。

net = disconnectLayers(net,"conv","batchnorm");

在图中显示更新后的网络。

figure
plot(net)

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

输入参数

全部折叠

神经网络,指定为 dlnetwork 对象。

连接源,指定为字符向量或字符串标量。

  • 如果源层只有一个输出,则 s 是该层的名称。

  • 如果源层有多个输出,则 s 是层名称后跟 "/" 字符和层输出的名称:"layerName/outputName"

示例: "conv"

示例: "mpool/indices"

连接目标,指定为字符串标量或字符向量。

  • 如果目标层只有一个输入,则 d 是该层的名称。

  • 如果目标层有多个输入,则 d 是层名称后跟 "/" 字符和层输入的名称:"layerName/inputName"

示例: "fc"

示例: "add/in1"

输出参量

全部折叠

更新后的网络,以未初始化的 dlnetwork 对象形式返回。

要初始化 dlnetwork 对象的可学习参数,请使用 initialize 函数。

disconnectLayers 函数不会保留量化信息。如果输入网络是量化网络,则输出网络不包含量化信息。

版本历史记录

在 R2017b 中推出

全部展开