nndata2gpu
Format neural data for efficient GPU training or simulation
Syntax
nndata2gpu(x)
[Y,Q,N,TS] = nndata2gpu(X)
nndata2gpu(X,PRECISION)
Description
nndata2gpu
requires Parallel Computing Toolbox™.
nndata2gpu(x)
takes an N
-by-Q
matrix X
of Q
N
-element column vectors, and returns it in a form for neural network
training and simulation on the current GPU device.
The N
-by-Q
matrix becomes a
QQ
-by-N
gpuArray where QQ
is
Q
rounded up to the next multiple of 32. The extra rows
(Q+1):QQ
are filled with NaN
values. The gpuArray has the
same precision ('single'
or 'double'
) as
X
.
[Y,Q,N,TS] = nndata2gpu(X)
can also take an
M
-by-TS
cell array of M
signals over
TS
time steps. Each element of X{i,ts}
should be an
Ni
-by-Q
matrix of Q
Ni
-element vectors, representing the i
th signal vector at
time step ts
, across all Q
time series. In this case, the
gpuArray Y
returned is
QQ
-by-(sum(Ni)*TS)
. Dimensions Ni
,
Q
, and TS
are also returned so they can be used with
gpu2nndata
to perform the reverse formatting.
nndata2gpu(X,PRECISION)
specifies the default precision of the
gpuArray, which can be 'double'
or 'single'
.
Examples
Copy a matrix to the GPU and back:
x = rand(5,6) [y,q] = nndata2gpu(x) x2 = gpu2nndata(y,q)
Copy neural network cell array data, representing four time series, each consisting of five time steps of 2-element and 3-element signals:
x = nndata([2;3],4,5) [y,q,n,ts] = nndata2gpu(x) x2 = gpu2nndata(y,q,n,ts)
Version History
Introduced in R2012b