現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
'Layer 1' is not a valid model name because it is not a valid MATLAB function name
28 ビュー (過去 30 日間)
古いコメントを表示
mar gian
2019 年 4 月 29 日
What does it mean is not a valid MATLAB function name? When I first generated a neural network with matlab 'Layer 1' name was autogenerated. How can i resolve this ? If I rename somehow the block name is enough or this may mean something else too?
Thanks in advance,
M
採用された回答
Fangjun Jiang
2019 年 4 月 29 日
編集済み: Fangjun Jiang
2019 年 4 月 29 日
remove the white space. call it "Layer1" or "Layer_1"
13 件のコメント
mar gian
2019 年 4 月 29 日
編集済み: mar gian
2019 年 4 月 30 日
As I wrote its a automated generated neural network ...this is how I generate the model
[x,t] = engine_dataset;
trainRatio = 0.8; valRatio = 0; testRatio = 0.2;
[trainInd, valInd, testInd] = dividerand(size(x, 2), trainRatio, valRatio, testRatio);
% Train the a 2-layerd neural network with 10 neurons in the hidden layer
% using training data
net = fitnet(10);
net = train(net,x(:, trainInd),t(:, trainInd));
so how can I remove the white spaces? or better how can I rename it ??
p.s I did search before I post here.
UPDATE: I did found how to just change th block names..and I feel stupid because all it took was just a double-click on the name. Now when I tried to run it it shows an error of" Layer_1" is not loaded. I guess I should change it elsewhere too except just on the diagram. But I have really no clue where!
mar gian
2019 年 5 月 1 日
The R2018a . Is there any relation with the errors that appear? A common problem or something?
Fangjun Jiang
2019 年 5 月 1 日
I have R2018b. Running the above code brings up a GUI. I don't know what you mean by model or block.
mar gian
2019 年 5 月 1 日
yes. as I wrote in the UPDATE section this code generates my neural network. After that with the command
[model_name, net_name] = gensim(net, 'Name', 'myNeural');
I am generating a simulink model . I am referring to the blocks there. My bad I put simulink on tags and nowhere else. So the thing is I found a way to rename the autogenerated blocks on my model (only by double clicking on the name) in simulink, but I should propably change it somewhere else too because it gives me an error for example : the block 'Layer_1' is not loaded.
I dont know where though!
Fangjun Jiang
2019 年 5 月 1 日
There is no error in R2018b. I saw the block "Layer 1" and "Layer 2" but it simulates and no error.
Check the value of net.layers{1}.name and net.layers{2}.name. In R2018b, it is "Hidden" and "Output". It seems unrelated.
Might be a bug on the Mathworks side. Contact the technical support.
mar gian
2019 年 5 月 1 日
Hidden and Output is to my version as well.....I think it make some sense since Layer 1 is the hidden layer and layer 2 results the output. So i dont think there is my problem .
If I rename my blocks from "Layer 1" to "Layer1" should i just double click the name and change it or should I do something else too?
P.SThanks for taking the time to help me!
Fangjun Jiang
2019 年 5 月 2 日
Got it run in R2018a. Model is generated and simulates. No error. Post your model if you still have issues.
mar gian
2019 年 5 月 2 日
This is what I am getting after renaming from "Layer 1" to "Layer_1" . If I dont change anything I get : 'Layer 1' is not a valid model name because it is not a valid MATLAB function name.
.png)
Walter Roberson
2019 年 5 月 3 日
The space is inserted at roughly line 338 of gensim, in the block of code that starts with the comment 'Network Block Names'. sprintf('Layer %g', i) . There is nothing you could do at the user level to designate a different name. You could probably create some code to change the block names.
If you examine
you will see that spaces are permitted in block names except as the first character of the name.
Now, model names have to be valid MATLAB function names, but layer names are block names, not model names.
Perhaps you are attempting to somehow invoke a layer directly as-if it were a model? For example you cannot open_system() a block directly: you have to open_system() the block qualified by the model name.
Fangjun Jiang
2019 年 5 月 3 日
The error message come from fxpoptdemo_neuralnetworks_script.m. It is looking for root level model "Layer_1" and block "Layer_1/tansig", which don't exist.
Using gensim() as it is, there is a block 'myNeural/Function Fitting Neural Network/Layer 1/tansig'. Using this in your script should get rid of this error.
mar gian
2019 年 5 月 4 日
"Perhaps you are attempting to somehow invoke a layer directly as-if it were a model? For example you cannot open_system() a block directly: you have to open_system() the block qualified by the model name"
Yes, I went through the code again and I found out that I had done this exact thing...
And even I renamed the block when autogenerated it kept showing errors. Anyway I changed that and now works fine.
MANY THANKS to both of you who responded and spend some amount of time !!!!!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Deep Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
アジア太平洋地域
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
