error while running graph=layerGraph(net)

graph = layerGraph(net);
Error using layerGraph
lgraph = layerGraph(net);
Invalid argument at position 1. Input must be an array of layers, a SeriesNetwork, a DAGNetwork, or a dlnetwork.

2 件のコメント

Matt J
Matt J 2023 年 5 月 14 日
So what's the question? Presumably your 'net' input is none of the the legal input types listed in the error message.
Tan
Tan 2023 年 5 月 14 日
編集済み: Walter Roberson 2023 年 5 月 14 日
net = googlenet('Weights','none');
%lys = net.Layers;
%lys(end-3:end)
numClasses = numel(categories(imdsTrain.Labels));
lgraph = layerGraph(net);
after that it show
Error using layerGraph
lgraph= layerGraph(net);
Invalid argument at position 1. Input must be an array of layers, a SeriesNetwork, a DAGNetwork, or a dlnetwork.

サインインしてコメントする。

回答 (1 件)

Matt J
Matt J 2023 年 5 月 14 日

0 投票

Like I said, your 'net' is not one fo the types listed in the error message:
net = googlenet('Weights','none');
net =
LayerGraph with properties:
Layers: [144×1 nnet.cnn.layer.Layer]
Connections: [170×2 table]
InputNames: {'data'}
OutputNames: {'output'}

4 件のコメント

Tan
Tan 2023 年 5 月 14 日
so how should i solve this?
Walter Roberson
Walter Roberson 2023 年 5 月 14 日
By now, R2023a, googlenet() returns DAGNetwork and the R2023a layerGraph() is happy with it.
In R2020b, googlenet() is documented as returning DAGNetwork and the error message implies layerGraph in that version should accept it.
Tan
Tan 2023 年 5 月 14 日
thanks a lot!
Matt J
Matt J 2023 年 5 月 14 日
編集済み: Matt J 2023 年 5 月 14 日
Why is a solution even required? You can see googlenet() is giving you a LayerGraph direcly, without the need for further manipulation.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

リリース

R2020b

質問済み:

Tan
2023 年 5 月 14 日

編集済み:

2023 年 5 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by