필터 지우기
필터 지우기

Error when using 'useGPU' for training neural networks

조회 수: 6 (최근 30일)
isledge
isledge 2016년 4월 13일
편집: HyeongHun LEE 2017년 10월 25일
I am receiving an error whenever I try to perform patternnet training with the 'useGPU' option. I am using MATLAB R2016a under Windows 7 SP1. The error also occurs in MATLAB R2015a under Windows 7 SP1. I have the latest NVIDIA CUDA toolkit installed (version 7.5). I also have the latest NVIDIA drivers installed for my GTX 780.
Whenever I run:
net=patternnet([10,10]);
net.trainFcn='trainlm';
net.layers{3}.transferFcn='softmax';
[net,tr]=train(net,x1',d1','useGPU','yes');
MATLAB defaults to using 'trainscg' for the default training method. The training is successfully performed using the GPU. Whenever I run:
net=patternnet([10,10]);
net.trainFcn='trainscg';
net.layers{3}.transferFcn='softmax';
[net,tr]=train(net,x1',d1','useGPU','yes');
MATLAB reports that there is an error using gpuArray/arrayfun:
Error using gpuArray/arrayfun
Variable 't' changed type. Consider renaming variable on left hand side of assignment.
For more information see Tips and Restrictions.
Error in 'netHints' (line: 666)
Error in nnGPUOp.bg (line 133)
[perfs1,perfs2,perfs3,N1,N2,N3,dy] =
arrayfun(hints.performFcns.perf_dy_3masks,ti,yi,en,ew,mask1,mask2,mask3,S);
Error in nnGPUOp.perfsGrad (line 5)
[gWB,Perfs,PerfN] = nnGPUOp.bg...
Error in nnCalcLib/perfsGrad (line 294)
lib.calcMode.perfsGrad(calcNet,lib.calcData,lib.calcHints);
Error in trainscg>initializeTraining (line 153)
[worker.perf,worker.vperf,worker.tperf,worker.gWB,worker.gradient] = calcLib.perfsGrad(calcNet);
Error in nnet.train.trainNetwork>trainNetworkInMainThread (line 28)
worker = localFcns.initializeTraining(archNet,calcLib,calcNet,tr);
Error in nnet.train.trainNetwork (line 16)
[archNet,tr] = trainNetworkInMainThread(archNet,rawData,calcLib,calcNet,tr,feedback,localFcns);
Error in trainscg>train_network (line 147)
[archNet,tr] = nnet.train.trainNetwork(archNet,rawData,calcLib,calcNet,tr,localfunctions);
Error in trainscg (line 59)
[out1,out2] = train_network(varargin{2:end});
Error in network/train (line 369)
[net,tr] = feval(trainFcn,'apply',net,data,calcLib,calcNet,tr);
If trainFnc is set to anything other than 'trainlm', such as 'trainbfg', I receive the same error.
Oddly enough, I don't encounter this error when training a feedforwardnet. I was able to succesfully use 'trainbfg', for example, without any issues. My sense is that there might be some toolbox coding issue for patternnets.

답변 (1개)

Amanjit Dulai
Amanjit Dulai 2016년 4월 25일
I suspect that the problem here is related to the type for the variable d1. I managed to replicate your error by using a single precision array for d1. Try casting it to double precision.
  댓글 수: 1
HyeongHun LEE
HyeongHun LEE 2017년 10월 25일
편집: HyeongHun LEE 2017년 10월 25일
I had a similar problem with this issue(for loop statement of gpu used-autoencoder), and solved with changed the array variable type(from single to double)in gpuarray. Thank you.

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

카테고리

Help CenterFile Exchange에서 GPU Computing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by