gpuArray

由于我要用matcovnet 来训练CNN,但遇到了


Error using vl_nnconv

DATA and FILTERS do not have compatible formats.

经过查询,在GPU 上训练时,要使用 gpuArray 来进行格式转换。


函数介绍:

----------------------------------------------------------------------------------------

gpuArray

Create array on GPU

Syntax

G = gpuArray(X)

Description

G = gpuArray(X) copies the numeric array X to the GPU, and returns a gpuArray object. You can operate on this array by passing its gpuArray to the feval method of a CUDA kernel object, or by using one of the methods defined for gpuArray objects in Establish Arrays on a GPU.

The MATLAB array X must be numeric (for example: singledoubleint8, etc.) or logical, and the GPU device must have sufficient free memory to store the data.

If the input argument is already a gpuArray, the output is the same as the input.

Use gather to retrieve the array from the GPU to the MATLAB workspace.

Examples

Transfer a 10-by-10 matrix of random single-precision values to the GPU, then use the GPU to square each element.

X = rand(10,'single');
G = gpuArray(X);
classUnderlying(G)
single
G2 = G .* G;         % Performed on GPU
whos G2              % Result on GPU
  Name       Size      Bytes  Class

  G2        10x10        108  gpuArray

Copy the array back to the MATLAB workspace.

G1 = gather(G2);
whos G1
  Name       Size      Bytes  Class

  G1        10x10        400  single

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值