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

2 visualizaciones (últimos 30 días)
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 nnGPUOp.bg
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] = nnGPUOp.bg...
Error in nnCalcLib/perfsGrad (line 294)
lib.calcMode.perfsGrad(calcNet,lib.calcData,lib.calcHints);
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);
>>

Respuestas (1)

David Willingham
David Willingham el 17 de Nov. de 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:

Categorías

Más información sobre Sequence and Numeric Feature Data Workflows en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by