Undefined function or variable 'replaceLayer'.

8 Ansichten (letzte 30 Tage)
carlos arizmendi
carlos arizmendi am 14 Nov. 2019
Kommentiert: KH TOHIDUL ISLAM am 22 Apr. 2022
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 Kommentare
MD.Tarikul Islam
MD.Tarikul Islam am 21 Feb. 2022
>> 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 am 22 Apr. 2022
Add following lines:
Layer_Graph = layerGraph(Layer_Graph);
Layer_Graph = replaceLayer(Layer_Graph, Feature_Learner.Name, New_Feature_Learner);

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sneha Kurhade
Sneha Kurhade am 14 Okt. 2020
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:

Kategorien

Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by