trainnetwork error, how to solve it?
Mostrar comentarios más antiguos
lgraph = layerGraph();
tempLayers = [
sequenceInputLayer(1,'Name','seqinput','Normalization','zscore')
convolution1dLayer(7,32,"Name","conv1d","Padding","same")
maxPooling1dLayer(3,"Name","maxpool1d","Padding","same")
leakyReluLayer(0.6,"Name","leakyrelu_1")
fullyConnectedLayer(10,'Name','branch1')
];
lgraph = addLayers(lgraph,tempLayers);
layers = [
featureInputLayer(4,'Normalization','zscore')
functionLayer(@(X) cbtocbt(X),Formattable=true)
fullyConnectedLayer(10,'Name','featurelast')]
dlnet = dlnetwork(layers);
lgraph = addLayers(lgraph,layers);
tempLayers = [
additionLayer(2,"Name","addition")
fullyConnectedLayer(50,"Name","fc_1")
leakyReluLayer(0.6)
fullyConnectedLayer(1,"Name","fc")
regressionLayer("Name","regressionoutput")];
lgraph = addLayers(lgraph,tempLayers);
clear tempLayers;
lgraph = connectLayers(lgraph,"branch1","addition/in1");
lgraph = connectLayers(lgraph,"featurelast","addition/in2");
analyzeNetwork(lgraph);
function Y = cbtocbt(X)
idxC = finddim(X,"C");
idxB = finddim(X,"B");
sizeS = size(X,idxS);
sizeC = size(X,idxC);
if ~isempty(idxB)
numChannels = sizeC;
sizeB = size(X,idxB);
X = reshape(X,[numChannels sizeB 1]);
Y = dlarray(X,"CBT");
end
end
and I got this error message
"다음 사용 중 오류가 발생함: trainNetwork
행렬 곱셈의 차원이 잘못되었습니다. 첫 번째 행렬의 열 개수가 두 번째 행렬의 행 개수와 일치하는지 확인하십시오. 행렬의 각 요소에 대해 개별적으로 연산을 수행하려면 요소별 곱셈 연산에 TIMES(.*)를 사용하십시오.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Deep Learning Toolbox en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!