Custom Neural Network Sample Code Fails on GPU
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
The sample architecture laid out in this guide https://www.mathworks.com/help/nnet/ug/create-and-train-custom-neural-network-architectures.html
Runs on CPU but fails on GPU.
The extra steps I added which are required to run efficiently on GPU
xg = nndata2gpu(X);
yg = nndata2gpu(Y);
and then either net = configure(net,X,T); OR using the [Xs,Xi,Ai,Ys,EWs,shift] = preparets(net,X,Y); method and sending all of the results to the gpu.
The problem appears to be when there are multiple input vectors of differing lengths. I have confirmed that this fails on simpler examples of similar type.
If there's no workaround this appears to be an issue preventing multiple input recurrent networks from running on the gpu. (I can try hacking a solution where every entry is a separate input vector, but this increases complexity and possibly might not work in all situations)
The Exception is: Dimensions of matrices being concatenated are not consistent.
Trace:
Error using cat
Dimensions of matrices being concatenated are not consistent.
Error in cell2mat (line 75)
m{n} = cat(2,c{n,:});
Error in nnGPU.pc (line 52)
xoffset = cell2mat(xoffset');
Error in nncalc.preCalcData>iPreCalcDataForNNDATA2GPU (line 43)
data.Pc = mode.pc(net,data.X,data.Xi,data.Q,data.TS,hints);
Error in nncalc.preCalcData (line 7)
data = iPreCalcDataForNNDATA2GPU(net,data,doPc);
Error in nncalc.setup1>setupImpl (line 176)
calcData = nncalc.preCalcData(matlabMode,matlabHints,net,data,doPc,doPd,calcHints.doFlattenTime);
Error in nncalc.setup1 (line 16)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = setupImpl(calcMode,net,data);
Error in nncalc.setup (line 7)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = nncalc.setup1(calcMode,net,data);
Error in network/train (line 357)
[calcLib,calcNet,net,resourceText] = nncalc.setup(calcMode,net,data);
0 commentaires
Réponses (1)
Amanjit Dulai
le 8 Sep 2017
Instead of using nndata2gpu to prepare your data for GPU training, you can use the 'useGPU' flag. Just change the call to train in the example to the following:
net = train(net,X,T, 'useGPU', 'yes');
1 commentaire
Voir également
Catégories
En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!