DLPrimitives
|
All Basic Operations on GPU. More...
Classes | |
class | AvgPooling2DBackward |
class | BatchNormFwdBwd |
Performs batch normalization computations over channel #1 (when #0 is batch) More... | |
class | BiasBackwardFilter |
Calculate filter. More... | |
class | Conv2DBackwardData |
Perform InnerProduct/FullyConnected/Dense backward data calculations. More... | |
class | Conv2DBackwardFilter |
Perform Conv2D backward filter calcilations. More... | |
class | Conv2DBase |
class | Conv2DForward |
Perform InnerProduct/FullyConnected/Dense forward calulations, allow fusing bias and activation into same GPU kernel. More... | |
struct | Conv2DSettings |
Configuration of Convoltion. More... | |
class | IPBackwardData |
Perform InnerProduct/FullyConnected/Dense backward data calculations. More... | |
class | IPBackwardFilter |
Perform InnerProduct/FullyConnected/Dense backward filter calcilations. More... | |
class | IPForward |
Perform InnerProduct/FullyConnected/Dense forward calulations, allow fusing bias and activation into same GPU kernel. More... | |
struct | IPSettings |
Configuration of InnerProduct layer. More... | |
class | MaxPooling2DBackward |
Backward computation for max pooling. More... | |
class | PointwiseOperationBroadcastReduce |
Perform pointwise operation with both boradcasting and reduction. More... | |
class | Pooling2DBackwardBase |
Backward pooling computation. More... | |
class | Pooling2DForward |
2d pooling More... | |
class | Scale |
Scale tensor by factor inplace, if s==0 fills with zero so nan is not propagated of s==0. More... | |
class | SliceCopy |
Class for copying a slice of an tensor. More... | |
class | Upscale |
Enumerations | |
enum | RandomDistribution { rnd_uniform = 0, rnd_normal = 1, rnd_bernoulli = 2 } |
Type of random distribution. | |
Functions | |
void | activation_forward (Tensor &x, Tensor &y, StandardActivations activation, ExecutionContext const &ec) |
Appliy activation on X save to Y, Y can be same as X. | |
void | activation_backward (Tensor &dx, Tensor &dy, Tensor &y, StandardActivations activation, float factor, ExecutionContext const &ec) |
Backward aclivation computed dx = dx * factor + backward(y,dy) | |
void | add_bias (Tensor &t, Tensor &b, ExecutionContext const &e) |
Add bias to t over dimentsion 1: t[:,i,:,:] = b[i]. | |
void | add_tensors (Tensor &a, Tensor &b, Tensor &sum, ExecutionContext const &ec) |
void | scale_tensor (float s, Tensor &t, ExecutionContext const &ec) |
Scale tensor by factor inplace, if s==0 fills with zero so nan is not propagated of s==0. | |
void | fill_tensor (Tensor &t, double value, ExecutionContext const &e) |
Set to zero tensor - OpenCL only. | |
void | fill_random (Tensor &t, cl_ulong philox_seed, cl_ulong philox_seq, RandomDistribution dist, float p1, float p2, ExecutionContext const &e) |
Fill tensor with random numbers using provided distribution. More... | |
void | softmax_forward (Tensor &x, Tensor &y, bool log_softmax, ExecutionContext const &e) |
Compute softmax output of x-> to y. if log_softmax true compute log of the output value. | |
void | softmax_backward (Tensor &dx, Tensor &y, Tensor &dy, bool log_softmax, float factor, ExecutionContext const &e) |
Softmax backpropogation. | |
void | nll_loss_forward (Tensor &x, Tensor &label, Tensor &y, bool reduce, float scale, ExecutionContext const &e) |
Compute forward Negative log likelehood loss x should be log of prob. | |
void | nll_loss_backward (Tensor &dx, Tensor &label, Tensor &dy, bool reduce, float scale, float factor, ExecutionContext const &e) |
Compute forward Negative log likelehood loss x should be log of prob. | |
void | bind_as_dtype (cl::Kernel &k, int &p, double value, DataType dt) |
Bind a parameter to kernet casting it to apropriate opencl type dt. | |
void | pointwise_operation (std::vector< Tensor > xs, std::vector< Tensor > ys, std::vector< double > ws, std::string const &code, ExecutionContext const &ec) |
per form operations function(xs,ws)->yw such that each tensor in xs and ys has same shape, ws are constant parameters More... | |
void | pointwise_operation_broadcast (std::vector< Tensor > xs, std::vector< Tensor > ys, std::vector< double > weights, std::string const &code, ExecutionContext const &e) |
Similar to pointwise_operation but xs are broadcasted numpy style. ys must much broadcasted shape, weights are considered of ys[0].dtype() | |
void | pointwise_operation_broadcast (std::vector< Tensor > xs, std::vector< Tensor > ys, std::vector< double > weights, std::vector< DataType > weights_types, std::string const &code, ExecutionContext const &e) |
Similar to pointwise_operation but xs are broadcasted numpy style. ys must much broadcasted shape. | |
int | calc_pooling_output_size (int in_size, int kernel, int pad, int stride, bool ceil_mode) |
Compute output size of the tensor after pooling in specific dimentions. | |
void | copy_strided (Shape shape, cl::Buffer const &src, cl_ulong src_offset, Shape src_strides, cl::Buffer const &dst, cl_ulong dst_offset, Shape dst_strides, DataType dtype, ExecutionContext const &q) |
All Basic Operations on GPU.
void dlprim::core::fill_random | ( | Tensor & | t, |
cl_ulong | philox_seed, | ||
cl_ulong | philox_seq, | ||
RandomDistribution | dist, | ||
float | p1, | ||
float | p2, | ||
ExecutionContext const & | e | ||
) |
Fill tensor with random numbers using provided distribution.
t | tesnor to fill |
philox_seed | - 64 bit seed for philox-2x4-10 algorithm |
philox_seq | - counter for RNG to start. Note each philox counter item generated 4 random numbers. So if you have tensor of size 100, that 25 items will be used [philox_seq, philox_seq + 25) |
distribution | type |
p1 | - min value for uniform and mu for normal |
p2 | - max value for uniform and sigma for normal |
void dlprim::core::pointwise_operation | ( | std::vector< Tensor > | xs, |
std::vector< Tensor > | ys, | ||
std::vector< double > | ws, | ||
std::string const & | code, | ||
ExecutionContext const & | ec | ||
) |
per form operations function(xs,ws)->yw such that each tensor in xs and ys has same shape, ws are constant parameters
code should perform assignment to variables y0 to yN and use x0..xM as values, and w0...wK as parameters for example: pointwise_operation({a,b},{c},{w},"y0 = x0*w0 + x1;",q);
Referenced by dlprim::solvers::Adam::apply().