grain.functions.unary

A module for unary functions

TODO: support cudnn functions (see PDF manual in .deb for detail https://developer.nvidia.com/cudnn) - activation (e.g., clipped-relu, elu), cudnnActivationForward/Backward - (non-log) softmax, cudnnSoftmaxForward/Backward - sqrt not, cudnnOpTensor - transform (e.g., contiguous or permute strides), cudnnTransformTensor - reshape (i.e., view), ...??? - reduce (sum, prod, min, max, amax, avg), cudnnReduceTensor - pool (max, average), cudnnPoolingForward/Backward - dropout, cudnnDropoutForward/Backward

Members

Aliases

AvgPool
alias AvgPool(T, size_t poolDims) = Pool!(false, T, poolDims)
Undocumented in source.
MaxPool
alias MaxPool(T, size_t poolDims) = Pool!(true, T, poolDims)
Undocumented in source.

Functions

logsumexp
logsumexp(S x)
Undocumented in source. Be warned that the author may not have intended to support it.
ndStrided
auto ndStrided(S s, ptrdiff_t[dim] strides)

n-dimensional strided

sumNdStrided
void sumNdStrided(S src, D dst, ptrdiff_t[dim] strides)
Undocumented in source. Be warned that the author may not have intended to support it.
unaryFunc
void unaryFunc(Variable!(float, dim, DeviceStorage) x)

wrapper of CUDA kernel unary functions

unaryPow
void unaryPow(Variable!(float, dim, DeviceStorage) x, float power)

wrapper of CUDA kernel pow function

unpad
auto unpad(S s, size_t[N] lengths)

only both is supported

Manifest constants

CUDNN_ACTIVATION_IMPL_MIXIN
enum CUDNN_ACTIVATION_IMPL_MIXIN;

Structs

Abs
struct Abs(T, size_t dim)

y = abs x

Cos
struct Cos(T, size_t dim)

y = cos x

Exp
struct Exp(T, size_t dim)

y = exp x

Log
struct Log(T, size_t dim)

y = exp x

LogSoftmax
struct LogSoftmax(T, size_t dim = 2)
Neg
struct Neg(T, size_t dim)

y = -x

Pool
struct Pool(bool isMax, T, size_t poolDims)

max pooling function

PoolRefImpl
struct PoolRefImpl(alias poolFun)

reference implementaion of pooling function

Pow
struct Pow(T, size_t dim)

y = pow x

ReLU
struct ReLU(T, size_t dim)

TODO implement scale with cudnnScaleTensor rectified linear unit nonlinearity (using cuDNN)

Reciprocal
struct Reciprocal(T, size_t dim)

y = 1 / x

Scale
struct Scale(T, size_t dim)

y = alpha * x

Sigmoid
struct Sigmoid(T, size_t dim)

sigmoid function

Sin
struct Sin(T, size_t dim)

y = sin x

Tan
struct Tan(T, size_t dim)

y = tan x

Tanh
struct Tanh(T, size_t dim)

hyperbolic tangent

Meta