Error using concatenationLayer Cannot define property 'Name'

Hello,
I am trying to define a concatenation layer in Matlab 2020a but I get the following error:
Error using concatenationLayer Cannot define property 'Name' in class 'concatenationLayer' because the property has already been defined in the superclass 'Layer'.
I get the same error even using the simple command from the help from matlab
concat = concatenationLayer(4,2,'Name','concat')
This is strange, because I have been using this command since version 2019a but now that I migrated to 2020a I get the error.
I hope anyone can help me to fix this issue.
Best regards,
José

 採用された回答

Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 7 月 30 日
編集済み: Harsha Priya Daggubati 2020 年 7 月 30 日

0 投票

Hi,
Did you try using a new layer name other than 'concat', as the error mentions the name has already been used in a superclass.
I tried to work the same at my end, it works completely fine for me.
If the problem still persists, try using the following commands and retry your work.
rehash toolbox
rehash toolboxcache

7 件のコメント

José Enrique Almanza Medina
José Enrique Almanza Medina 2020 年 7 月 30 日
Hi,
I tried both commands but I still get the error, even starting a new matlab session. Please take a look on the image:
I also tried using the graphics interface. If I use the exact same command after opening the new session, it works. However, if I try to use the command in a script, I get the same error, even if it is the first line in the code.
Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 7 月 30 日
編集済み: Harsha Priya Daggubati 2020 年 7 月 30 日
Could you just remove 'Name' property from layer creation. Can you also try this out and see
concat_1 = concatenationLayer(4,2,'Name','concat_1');
relu_1 = reluLayer('Name','relu_1');
relu_2 = reluLayer('Name','relu_2');
lgraph = layerGraph();
lgraph = addLayers(lgraph, relu_1);
lgraph = addLayers(lgraph, relu_2);
lgraph = addLayers(lgraph, concat_1);
lgraph = connectLayers(lgraph, 'relu_1', 'concat_1/in1');
lgraph = connectLayers(lgraph, 'relu_2', 'concat_1/in2');
plot(lgraph);
José Enrique Almanza Medina
José Enrique Almanza Medina 2020 年 7 月 30 日
I just tried, this is strange, I get the exact same error now that I don't include the Name property:
Best regards,
José
Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 7 月 30 日
Did you do any other layer creations prior to this step?
José Enrique Almanza Medina
José Enrique Almanza Medina 2020 年 7 月 30 日
I did not create another layer, it is just the first line I type after launching matlab.
Also, I tried the code that you gave me but unfortunately I got the same error.
I did a workaround by defining the network architecture in another computer with Matlab 2019a and saving it and then I just load it in the 2020a version, then I can train the network, but it would be useful to be able to define it in the computer with 2020a version.
Harsha Priya Daggubati
Harsha Priya Daggubati 2020 年 7 月 30 日
Hi,
Can you just give a try with this command:
which concatenationLayer
This will be the expected output for the above command:
'C:\Program Files\MATLAB\R2020a\toolbox\nnet\cnn\concatenationLayer.m'
José Enrique Almanza Medina
José Enrique Almanza Medina 2020 年 7 月 30 日
Hi,
That command showed me that I had a function made by me with the exact same name in my MATLAB folders. I think this is an old attempt to create my own version of the layer. This is quite silly from my side, it got mixed between a lot of scripts.
I removed it and that fixed the issue. Thanks a lot for your assitance.
Best regards,
José Almanza

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

その他の回答 (0 件)

カテゴリ

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

製品

リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by