grain.cudnn

cuDNN high level wrapper for grain.autograd.Variable

TODO: support global workspace instead of frequent allocation

Members

Functions

activationBackward
void activationBackward(Variable!(T, dim, DeviceStorage) gx, Variable!(T, dim, DeviceStorage) gy, Variable!(T, dim, DeviceStorage) x, Variable!(T, dim, DeviceStorage) y, T alpha = 1.0, T beta = 0.0, double coeff = 0.0)

grad function of sigmoid/tanh ... etc wrapper

activationForward
void activationForward(Variable!(T, dim, DeviceStorage) x, Variable!(T, dim, DeviceStorage) y, T alpha = 1.0, T beta = 0.0, double coeff = 0.0)

y = alpha * f(x) + beta * y

convBackward
void convBackward(ref Variable!(T, dim, DeviceStorage) gradInput, Variable!(T, dim, DeviceStorage) input, ref Variable!(T, dim, DeviceStorage) gradFilter, Variable!(T, dim, DeviceStorage) filter, Variable!(T, dim, DeviceStorage) gradOutput, const int[imDims] stride, const int[imDims] pad, const int[imDims] dilation, int ngroup = 1, cudnnConvolutionBwdDataAlgo_t algo = CUDNN_CONVOLUTION_BWD_DATA_ALGO_1, float alpha = 1, float beta = 0)

wrapper of cudnnConvolutionBackwardData and Weight for Variable

convForward
void convForward(Variable!(T, dim, DeviceStorage) input, Variable!(T, dim, DeviceStorage) filter, ref Variable!(T, dim, DeviceStorage) output, const int[imDims] stride, const int[imDims] pad, const int[imDims] dilation, int ngroup = 1, cudnnConvolutionFwdAlgo_t algo = CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM, float alpha = 1, float beta = 0)

wrapper of cudnnConvolutionForward for Variable

cudnnDataType
auto cudnnDataType()

convert floating point types (float, double) into cudnn enum

fill
void fill(Variable!(T, dim, DeviceStorage) x, T value)

x[] = value (WARNING: not tested)

isContiguous
bool isContiguous(Variable!(T, dim, Storage) x)

WIP

isDeterministic
auto isDeterministic()
isNanProp
auto isNanProp()

return global cudnn option

makeCudnnTensor
auto makeCudnnTensor(Variable!(T, dim, DeviceStorage) x)

convert variable to cudnn tensor discriptor object

makeCudnnTensor
auto makeCudnnTensor(ref T storage)

convert contiguous cuda storage to 1-D tensor disc

poolBackward
void poolBackward(ref Variable!(T, _tensorDims, DeviceStorage) gradInput, Variable!(T, _tensorDims, DeviceStorage) input, Variable!(T, _tensorDims, DeviceStorage) gradOutput, Variable!(T, _tensorDims, DeviceStorage) output, int[_poolDims] windowDim, int[_poolDims] padding, int[_poolDims] stride, T alpha = 1, T beta = 0)

wrapper of cudnnPoolingBackward for Variable

poolForward
auto poolForward(Variable!(T, _tensorDims, DeviceStorage) input, int[_poolDims] windowDim, int[_poolDims] padding, int[_poolDims] stride, T alpha = 1, T beta = 0)

wrapper of cudnnPoolingForward for Variable

reduce
void reduce(Variable!(T, dim, DeviceStorage) src, Variable!(T, dim, DeviceStorage) dst, T alpha = 1, T beta = 0)

Tensor operation : C = reduce op( alpha * A ) + beta * C

scale
void scale(Variable!(T, dim, DeviceStorage) x, T alpha)

x = alpha x

softmaxBackward
void softmaxBackward(Variable!(T, dim, DeviceStorage) gx, Variable!(T, dim, DeviceStorage) gy, Variable!(T, dim, DeviceStorage) y, T alpha = 1.0, T beta = 0.0)

grad of softmax

softmaxForward
void softmaxForward(Variable!(T, dim, DeviceStorage) x, Variable!(T, dim, DeviceStorage) y, T alpha = 1.0, T beta = 0.0)

compute the softmax over all C for each H, W, N

tensorOp
void tensorOp(Variable!(T, dim, DeviceStorage) c, Variable!(T, dim, DeviceStorage) a, Variable!(T, dim, DeviceStorage) b, T alpha1 = 1, T alpha2 = 1, T beta = 0)

Tensor operation : C = op( alpha1 * A, alpha2 * B ) + beta * C

transform
void transform(Variable!(T, dim, DeviceStorage) src, ref Variable!(T, dim, DeviceStorage) dst, T alpha = 1, T beta = 0)

copy src to dst with broadcasting

Structs

TensorDesc
struct TensorDesc

cudnn data type of variable like struct

ThreadLocalDropout
struct ThreadLocalDropout

Global (thread local) dropout state with descriptor and state array

Meta