Undefined function or variable 'replaceLayer'.

layers = [
imageInputLayer([28 28 1],'Name','input')
convolution2dLayer(5,20,'Name','conv_1')
reluLayer('Name','relu_1')
additionLayer(2,'Name','add')
fullyConnectedLayer(10,'Name','fc')
softmaxLayer('Name','softmax')
classificationLayer('Name','classoutput')];
lgraph = layerGraph(layers);
lgraph = connectLayers(lgraph,'input','add/in2');
>> larray = [batchNormalizationLayer('Name','BN1')
leakyReluLayer('Name','leakyRelu_1','Scale',.02)];
newlgraph = replaceLayer(lgraph,'relu_1',larray);
Undefined function or variable 'replaceLayer'.
Why in some computers works and in other it does not works and they are the same version with the same toolboxes??

6 件のコメント

Adam Danz
Adam Danz 2019 年 11 月 14 日
編集済み: Adam Danz 2020 年 2 月 21 日
replaceLayer() is from the Deep Learning Toolbox and was released in r2018b although there is mention of it in the r2018a release notes. Run ver() to print a list of available toolboxes and confirm that you have this toolbox. replaceLayer is a class method of layerGraph class.
Adam Danz
Adam Danz 2020 年 2 月 20 日
Ahmed's answer moved here as a comment.
Same here it dose not work with me ?????+++++++
Sai Bhargav Avula
Sai Bhargav Avula 2020 年 3 月 24 日
is it same error. As mentioned by Adam try checking the ver and availability of the toolbox
Also, did you try rehashing the toolbox?
if not
use the
rehash toolbox
Sneha Kurhade
Sneha Kurhade 2020 年 10 月 14 日
The 'replaceLayer' function is not a standalone m function. It is a class method of 'layerGraph' class.
Since it is a class method, it is defined in the class file for 'layerGraph' and can be used only with particular layers.
For more information, please refer the 'Objective Functions' of 'layerGraph' at the documentation link mentioned below:
MD.Tarikul Islam
MD.Tarikul Islam 2022 年 2 月 21 日
>> training
Undefined function or variable 'replaceLayer'.
Error in training (line 22)
Layer_Graph = replaceLayer(Layer_Graph, Feature_Learner.Name, New_Feature_Learner);
how can solve this problem??
KH TOHIDUL ISLAM
KH TOHIDUL ISLAM 2022 年 4 月 22 日
Add following lines:
Layer_Graph = layerGraph(Layer_Graph);
Layer_Graph = replaceLayer(Layer_Graph, Feature_Learner.Name, New_Feature_Learner);

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

回答 (1 件)

Sneha Kurhade
Sneha Kurhade 2020 年 10 月 14 日

2 投票

The 'replaceLayer' function is not a standalone m function. It is a class method of 'layerGraph' class.
Since it is a class method, it is defined in the class file for 'layerGraph' and can be used only with particular layers.
For more information, please refer the 'Objective Functions' of 'layerGraph' at the documentation link mentioned below:

カテゴリ

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

製品

リリース

R2019b

質問済み:

2019 年 11 月 14 日

コメント済み:

2022 年 4 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by