Sequence-to-Sequence Classification Using 1-D Convolutions
2 views (last 30 days)
Parichada Trairat on 21 Sep 2021
Follow this https://www.mathworks.com/help/deeplearning/ug/sequence-to-sequence-classification-using-1-d-convolutions.html#SeqToSeqClassificationUsing1DConvAndModelFunctionExample-13
I try to adapt the model and simulation it, but it has an error when I train the model step
I don't understand about the error what does it mean?
Error using dlfeval (line 43)
Number of channels of weights (3, specified by the size of the 'C' dimension of weights) must be equal to the
size of the 'C' dimension of the input data (2).
Error in CNN_test (line 104)
[gradients, loss] = dlfeval(@modelGradients,parameters,hyperparameters,dlX,dlY,mask);
Katja Mogalle on 22 Sep 2021
Just from this error and without the complete code, it's difficult to say what exactly is wrong.
I suspect that some parameters of the model were initialized to the wrong size.
You might get a better error message if you put a breakpoint on line 104 and instead of executing the call to dlfeval, you can run the following code in the command window:
yPred = model(dlX,parameters,hyperparameters,true);
yPred = softmax(yPred,'DataFormat','CBT');
dlT = dlarray(dlY,'CBT');
loss = maskedCrossEntropyLoss(yPred, dlT, numTimeSteps);
I'd expect one of these lines to error and hopefully the error better reveals where the problem is.