trainNetwork invalid network

95 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2018 年 7 月 23 日
編集済み: MathWorks Support Team 2021 年 9 月 28 日
Why am I getting an invalid network error from trainNetwork? It says layers are not connected and that the input layer is not first and the output layer is not last. I am resuming functionality of my network following the directions in the link below. When I visualize my layers, they are all connected properly and the first layer is the input layer and the last is the output. Why am I getting these errors?
Error using trainNetwork (line 154)
Invalid network.
Caused by:
Layer 'L1': Missing input. Each layer input must be connected to the
output of another layer.
Layer 'L3': Missing input. Each layer input must be connected to the
output of another layer.
Detected missing inputs:
input 'in2'
...
Layer 'L7': Unused output. Each layer output must be connected to the
input of another layer.
Layer 'L0': An input layer must be first in the layer array.
Layer 'Lend': An output layer must be last in the layer array.

採用された回答

MathWorks Support Team
MathWorks Support Team 2021 年 9 月 2 日
編集済み: MathWorks Support Team 2021 年 9 月 28 日
This error is due to a DAGNetwork object being inputted into the trainNetwork for the layers. The correct workflow is to use a Layer array or a LayerGraph object as input to trainNetwork:
 
To fix the issue, convert the DAGNetwork object into a LayerGraph object first before training:
>> newnet = trainNetwork(source, layerGraph(net),options);
The layer graph describes the architecture of a DAG network (layers and connections). Net.Layers is missing the connections causing those errors.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBuild Deep Neural Networks についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by