Why does the deep learning toolbox cannot work?

I write the following code to test the toolbox, however, it always comes out such error that i couldn't solve. I've already redownload and reinstalled matlab for three times,including 2019b and 2020a but it still fails.
I have sent this code to my friend's PC, and she can run it successfully. I also tried using the APP(neural net fitting) and the default datasets without modifying any parameters, it fails again. So, what's wrong??????
code:
clc;clear;
input = [0:0.1:1 ; 1:0.1:2]; % each column represent a sample
target = input(1,:).^2+input(2,:).^2;
net=feedforwardnet(10);
view(net);
net = train(net,input,target);
command error:
无法执行赋值,因为左侧的大小为 2×2,右侧的大小为 2×11
出错 initnw>initialize_layer (line 176)
range(inputStart(j):inputStop(j),:) =
temp2((inputStart(j):inputStop(j))-inputStart(j)+1,:);
出错 initnw (line 101)
out1 = initialize_layer(in1,in2);
出错 initlay>initialize_network (line 155)
net = feval(initFcn,net,i);
出错 initlay (line 97)
out1 = initialize_network(in1);
出错 network/init (line 31)
net = feval(initFcn,net);
出错 network/configure (line 253)
net = init(net);
出错 nntraining.config (line 146)
net = configure(network(net),X,T);
出错 nntraining.setup>setupPerWorker (line 102)
[net,X,Xi,Ai,T,EW,Q,TS,err] = nntraining.config(net,X,Xi,Ai,T,EW,configNetEnable);
出错 nntraining.setup (line 77)
[net,data,tr,err] = setupPerWorker(net,trainFcn,X,Xi,Ai,T,EW,enableConfigure);
出错 network/train (line 335)
[net,data,tr,err] = nntraining.setup(net,net.trainFcn,X,Xi,Ai,T,EW,enableConfigure,isComposite);
出错 untitled4 (line 6)
net = train(net,input,target);
App error:

댓글 수: 5

What shows up for
which -all repmat
>> which -all repmat
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/repmat)
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@char/repmat) % char method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@double/repmat) % double method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@int16/repmat) % int16 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@int32/repmat) % int32 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@int64/repmat) % int64 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@int8/repmat) % int8 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@logical/repmat) % logical method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@single/repmat) % single method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@uint16/repmat) % uint16 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@uint32/repmat) % uint32 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@uint64/repmat) % uint64 method
built-in (/Applications/MATLAB_R2020a.app/toolbox/matlab/elmat/@uint8/repmat) % uint8 method
repmat is a built-in method % connector.internal.LoggerLevel method
repmat is a built-in method % matlab.lang.OnOffSwitchState method
/Applications/MATLAB_R2020a.app/toolbox/matlab/bigdata/@tall/repmat.m % tall method
/Applications/MATLAB_R2020a.app/toolbox/symbolic/symbolic/@symfun/repmat.m % symfun method
dbstop at initnw 173
and run your code. When it stops at line 173, look at irange : it should be a 2 x 2 array.
now
dbstep
dbstep
which should take you to line 176. Examine the value of inputDelays(j) which should be 1. Examine the size of temp2 which should be a 2 x 2 array.
Now dbstep again to execute the line you were having problems with.If it works then the problem did not occur. If it does not work, then look at the size and values of all of the variables mentioned on the row to help figure out what the problem might be.
irange = net.inputs{inputInds(j)}.processedRange;
i did it following your instrcutions, however the size of irange is equal to 2✖️11
irange=[NaN 0 1 NaN 1 NaN 0 NaN NaN 1 NaN;
NaN 1 0 NaN 0 NaN 1 NaN NaN 0 NaN]
This is part of initnw.m. I don't understand why the size of net.inputs{inputInds(j)}.processedRange is not 2✖️2
function net = initialize_layer(net,i)
% Calculate source indices
inputInds = find(net.inputConnect(i,:));
numInputs = length(inputInds);
layerInds = find(net.layerConnect(i,:));
numLayers = length(layerInds);
% Get source sizes and delays
inputSizes = zeros(numInputs,1);
inputDelays = zeros(numInputs,1);
for j=1:numInputs
inputDelays(j) = length(net.inputWeights{i,inputInds(j)}.delays);
inputSizes(j) = net.inputWeights{i,inputInds(j)}.size(2);
end
totalInputSize = sum(inputSizes);
layerSizes = zeros(numLayers,1);
layerDelays = zeros(numInputs,1);
for j=1:numLayers
layerDelays(j) = length(net.layerWeights{i,layerInds(j)}.delays);
layerSizes(j) = net.layerWeights{i,layerInds(j)}.size(2);
end
totalLayerSize = sum(layerSizes);
totalSourceSize = totalInputSize + totalLayerSize;
% Calculate range indices
inputStart = cumsum([1; inputSizes]);
inputStop = cumsum(inputSizes);
layerStart = cumsum([1; layerSizes])+totalInputSize;
layerStop = cumsum(layerSizes)+totalInputSize;
% Get source ranges
range = zeros(totalSourceSize,2);
for j=1:numInputs
irange = net.inputs{inputInds(j)}.processedRange;
if ~isempty(irange)
% ODJ 4/1/02 Avoid problem with delays and one column weights
temp1=size(irange,1)*inputDelays(j);
if temp1~= inputStop(j)-inputStart(j)-1
temp2 = repmat(irange,inputDelays(j),1);
range(inputStart(j):inputStop(j),:) = temp2((inputStart(j):inputStop(j))-inputStart(j)+1,:);
else
range(inputStart(j):inputStop(j),:) = repmat(irange,inputDelays(j),1);
end
end
end

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 8월 16일

댓글:

2020년 8월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by