이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
'Layer 1' is not a valid model name because it is not a valid MATLAB function name
조회 수: 29 (최근 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!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 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 (한국어)