Is there a fix for trainAutoencoder with GPU speedup that crashes with single precision inputs (OK on double precision inputs)

2 visualizzazioni (ultimi 30 giorni)
Gaming GPUs are optimized for single precision math. But trainAutoencoder crashes on explicit single precision inputs
is there a way to use single precision (and keep gaming GPU speedup) in trainAutoencoder?
% --------------- these are all OK --------------
trainAutoencoder(single(rand(2,100)), 'useGPU', false);
trainAutoencoder(double(rand(2,100)), 'useGPU', false);
trainAutoencoder(double(rand(2,100)), 'useGPU', true);
% --------------- specifically using single precision and GPU - this crashes --------------
>> trainAutoencoder(single(rand(2,100)), 'useGPU', true)
Error using
Variable 'perfs1' changed type. Consider renaming variable on left hand side of assignment.
For more information see Tips.
Error in 'netHints' (line: 768)
Error in nnGPUOp.perfsGrad (line 6)
[gWB,Perfs,PerfN] =
Error in nnCalcLib/perfsGrad (line 294)
Error in trainscg>initializeTraining (line 151)
[worker.perf,worker.vperf,worker.tperf,worker.gWB,worker.gradient] = calcLib.perfsGrad(calcNet);
Error in nnet.train.trainNetwork>trainNetworkInMainThread (line 39)
worker = localFcns.initializeTraining(archNet,calcLib,calcNet,tr);
Error in nnet.train.trainNetwork (line 27)
[archNet,tr] = trainNetworkInMainThread(archNet,rawData,calcLib,calcNet,tr,feedback,localFcns);
Error in trainscg>train_network (line 145)
[archNet,tr] = nnet.train.trainNetwork(archNet,rawData,calcLib,calcNet,tr,localfunctions);
Error in trainscg (line 55)
[out1,out2] = train_network(varargin{2:end});
Error in network/train (line 380)
[net,tr] = feval(trainFcn,'apply',net,data,calcLib,calcNet,tr);
Error in Autoencoder.train (line 511)
net = train(net,X,X,'useGPU',iYesOrNo(useGPU));
Error in trainAutoencoder (line 109)
autoenc = Autoencoder.train(X, autonet, paramsStruct.UseGPU);

Risposte (1)

David Willingham
David Willingham il 17 Nov 2022
Hi Kyle,
There isn't single precision support for GPU with trainAutoencoder. It's an older implementation of autoencoders.
If you're looking for speedup, I'd recommend trying to autoencoders using the newer deep learning framework. An example can be found here:




Community Treasure Hunt

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

Start Hunting!

Translated by