|
static void | ConvLayerForward (Tensor_t &output, Tensor_t &inputActivationFunc, const Tensor_t &input, const Matrix_t &weights, const Matrix_t &biases, const DNN::CNN::TConvParams ¶ms, EActivationFunction activFunc, Tensor_t &, const ConvDescriptors_t &, ConvWorkspace_t &) |
| Forward propagation in the Convolutional layer. More...
|
|
static Tensor_t | CreateTensor (DeviceBuffer_t buffer, size_t n, size_t c, size_t h, size_t w) |
|
static Tensor_t | CreateTensor (size_t n, size_t c, size_t h, size_t w) |
|
static void | CreateWeightTensors (std::vector< Matrix_t > &newWeights, const std::vector< Matrix_t > &weights) |
|
static void | FreeConvWorkspace (TWorkspace *&, ConvLayer_t *) |
| Only used for certain cudnn on-device memory. More...
|
|
static void | FreePoolDropoutWorkspace (TWorkspace *&, PoolingLayer_t *) |
|
static TMVA::Experimental::MemoryLayout | GetTensorLayout () |
|
static void | InitializeActivationDescriptor (ActivationDescriptor_t &, EActivationFunction, double=0.0) |
|
static void | InitializeBNormDescriptors (TDescriptors *&, BNormLayer_t *) |
| Initialize CNN data/operator descriptors. More...
|
|
static void | InitializeConvDescriptors (TDescriptors *&, ConvLayer_t *) |
|
static void | InitializeConvWorkspace (TWorkspace *&, TDescriptors *&, const DNN::CNN::TConvParams &, ConvLayer_t *) |
|
static void | InitializePoolDescriptors (TDescriptors *&, PoolingLayer_t *) |
|
static void | InitializePoolDropoutWorkspace (TWorkspace *&, TDescriptors *&, const DNN::CNN::TConvParams &, PoolingLayer_t *) |
|
static void | PrepareInternals (Tensor_t &) |
| Dummy placeholder - preparation is currently only required for the CUDA architecture. More...
|
|
static void | ReleaseBNormDescriptors (TDescriptors *&) |
|
static void | ReleaseConvDescriptors (TDescriptors *&) |
| Release CNN data/operator descriptors. More...
|
|
static void | ReleaseDescriptor (ActivationDescriptor_t &) |
|
static void | ReleasePoolDescriptors (TDescriptors *&) |
|
|
Low-level functions required for the forward propagation of activations through the network.
|
static void | MultiplyTranspose (Matrix_t &output, const Matrix_t &input, const Matrix_t &weights) |
| Matrix-multiply input with the transpose of \pweights and write the results into output . More...
|
|
static void | MultiplyTranspose (Tensor_t &output, const Tensor_t &input, const Matrix_t &weights) |
|
static void | AddRowWise (Matrix_t &output, const Matrix_t &biases) |
| Add the vectors biases row-wise to the matrix output. More...
|
|
static void | AddRowWise (Tensor_t &output, const Matrix_t &biases) |
|
|
Low-level functions required for the forward propagation of activations through the network.
|
static void | Backward (Tensor_t &activationGradientsBackward, Matrix_t &weightGradients, Matrix_t &biasGradients, const Tensor_t &df, const Tensor_t &activationGradients, const Matrix_t &weights, const Tensor_t &activationBackward) |
| Perform the complete backward propagation step. More...
|
|
static void | ScaleAdd (Matrix_t &A, const Matrix_t &B, Scalar_t beta=1.0) |
| Adds a the elements in matrix B scaled by c to the elements in the matrix A. More...
|
|
static void | Copy (Matrix_t &B, const Matrix_t &A) |
|
template<typename AMatrix_t > |
static void | CopyDiffArch (Matrix_t &B, const AMatrix_t &A) |
|
static void | ScaleAdd (Tensor_t &A, const Tensor_t &B, Scalar_t beta=1.0) |
| Above functions extended to vectors. More...
|
|
static void | Copy (Tensor_t &A, const Tensor_t &B) |
|
template<typename ATensor_t > |
static void | CopyDiffArch (Tensor_t &A, const ATensor_t &B) |
|
template<typename AMatrix_t > |
static void | CopyDiffArch (std::vector< Matrix_t > &A, const std::vector< AMatrix_t > &B) |
|
|
For each activation function, the low-level interface contains two routines.
One that applies the acitvation function to a matrix and one that evaluate the derivatives of the activation function at the elements of a given matrix and writes the results into the result matrix.
|
static void | ActivationFunctionForward (Tensor_t &X, EActivationFunction activFunct, const ActivationDescriptor_t activationDescr, const double coef=0.0, const AFloat alpha=1, const AFloat beta=0) |
|
static void | ActivationFunctionBackward (Tensor_t &dX, const Tensor_t &Y, const Tensor_t &dY, const Tensor_t &X, EActivationFunction activFunct, const ActivationDescriptor_t activationDescr, const AFloat alpha=1, const AFloat beta=0) |
| Computes the gradient of the activation function. More...
|
|
static void | IdentityDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | Relu (Tensor_t &B) |
|
static void | ReluDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | Sigmoid (Tensor_t &B) |
|
static void | SigmoidDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | Tanh (Tensor_t &B) |
|
static void | TanhDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | SymmetricRelu (Tensor_t &B) |
|
static void | SymmetricReluDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | SoftSign (Tensor_t &B) |
|
static void | SoftSignDerivative (Tensor_t &B, const Tensor_t &A) |
|
static void | Gauss (Tensor_t &B) |
|
static void | GaussDerivative (Tensor_t &B, const Tensor_t &A) |
|
|
Loss functions compute a scalar value given the output of the network for a given training input and the expected network prediction Y that quantifies the quality of the prediction.
For each function also a routing that computes the gradients (suffixed by Gradients) must be provided for the starting of the backpropagation algorithm.
|
static Scalar_t | MeanSquaredError (const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
|
static void | MeanSquaredErrorGradients (Matrix_t &dY, const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
|
static Scalar_t | CrossEntropy (const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
| Sigmoid transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net. More...
|
|
static void | CrossEntropyGradients (Matrix_t &dY, const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
|
static Scalar_t | SoftmaxCrossEntropy (const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
| Softmax transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net. More...
|
|
static void | SoftmaxCrossEntropyGradients (Matrix_t &dY, const Matrix_t &Y, const Matrix_t &output, const Matrix_t &weights) |
|
|
Output functions transform the activations output of the output layer in the network to a valid prediction YHat for the desired usage of the network, e.g.
the identity function for regression or the sigmoid transformation for two-class classification.
|
static void | Sigmoid (Matrix_t &YHat, const Matrix_t &) |
|
static void | Softmax (Matrix_t &YHat, const Matrix_t &) |
|
|
For each regularization type two functions are required, one named <Type>Regularization that evaluates the corresponding regularization functional for a given weight matrix and the Add<Type>RegularizationGradients , that adds the regularization component in the gradients to the provided matrix.
|
static Scalar_t | L1Regularization (const Matrix_t &W) |
|
static void | AddL1RegularizationGradients (Matrix_t &A, const Matrix_t &W, Scalar_t weightDecay) |
|
static Scalar_t | L2Regularization (const Matrix_t &W) |
|
static void | AddL2RegularizationGradients (Matrix_t &A, const Matrix_t &W, Scalar_t weightDecay) |
|
|
For each initialization method, one function in the low-level interface is provided.
The naming scheme is
Initialize<Type>
for a given initialization method Type.
|
static void | InitializeGauss (Matrix_t &A) |
|
static void | InitializeUniform (Matrix_t &A) |
|
static void | InitializeIdentity (Matrix_t &A) |
|
static void | InitializeZero (Matrix_t &A) |
|
static void | InitializeGlorotNormal (Matrix_t &A) |
|
static void | InitializeGlorotUniform (Matrix_t &A) |
|
static TRandom & | GetRandomGenerator () |
|
static void | SetRandomSeed (size_t seed) |
|
|
static void | DropoutForward (Tensor_t &A, TDescriptors *descriptors, TWorkspace *workspace, Scalar_t p) |
| Apply dropout with activation probability p to the given tensor A and scale the result by reciprocal of p . More...
|
|
static void | DropoutForward (Matrix_t &A, Scalar_t p) |
|
static void | DropoutBackward (Tensor_t &, TDescriptors *, TWorkspace *) |
|
|
static void | BatchNormLayerForwardTraining (int axis, const Tensor_t &x, Tensor_t &y, Matrix_t &gamma, Matrix_t &beta, Matrix_t &mean, Matrix_t &, Matrix_t &iVariance, Matrix_t &runningMeans, Matrix_t &runningVars, Scalar_t nTrainedBatches, Scalar_t momentum, Scalar_t epsilon, const TensorDescriptor_t &bnParDescriptor) |
| The input from each batch are normalized during training to have zero mean and unit variance and they are then scaled by two parameter, different for each input variable: More...
|
|
static void | BatchNormLayerForwardInference (int axis, const Tensor_t &x, Matrix_t &gamma, Matrix_t &beta, Tensor_t &y, const Matrix_t &runningMeans, const Matrix_t &runningVars, Scalar_t epsilon, const TensorDescriptor_t &) |
| During inference the inputs are not normalized using the batch mean but the previously computed at running mean and variance. More...
|
|
static void | BatchNormLayerBackward (int axis, const Tensor_t &x, const Tensor_t &dy, Tensor_t &dx, Matrix_t &gamma, Matrix_t &dgamma, Matrix_t &dbeta, const Matrix_t &mean, const Matrix_t &variance, const Matrix_t &iVariance, Scalar_t epsilon, const TensorDescriptor_t &) |
|
|
static size_t | calculateDimension (size_t imgDim, size_t fltDim, size_t padding, size_t stride) |
| Calculate how many neurons "fit" in the output layer, given the input as well as the layer's hyperparameters. More...
|
|
static void | Im2col (Matrix_t &A, const Matrix_t &B, size_t imgHeight, size_t imgWidth, size_t fltHeight, size_t fltWidth, size_t strideRows, size_t strideCols, size_t zeroPaddingHeight, size_t zeroPaddingWidth) |
| Transform the matrix B in local view format, suitable for convolution, and store it in matrix A. More...
|
|
static void | Im2colIndices (std::vector< int > &V, const Matrix_t &B, size_t nLocalViews, size_t imgHeight, size_t imgWidth, size_t fltHeight, size_t fltWidth, size_t strideRows, size_t strideCols, size_t zeroPaddingHeight, size_t zeroPaddingWidth) |
|
static void | Im2colFast (Matrix_t &A, const Matrix_t &B, const std::vector< int > &V) |
|
static void | RotateWeights (Matrix_t &A, const Matrix_t &B, size_t filterDepth, size_t filterHeight, size_t filterWidth, size_t numFilters) |
| Rotates the matrix B , which is representing a weights, and stores them in the matrix A . More...
|
|
static void | AddConvBiases (Matrix_t &output, const Matrix_t &biases) |
| Add the biases in the Convolutional Layer. More...
|
|
|
static void | ConvLayerBackward (Tensor_t &activationGradientsBackward, Matrix_t &weightGradients, Matrix_t &biasGradients, Tensor_t &df, Tensor_t &activationGradients, const Matrix_t &weights, const Tensor_t &activationBackward, const Tensor_t &outputTensor, EActivationFunction activFunc, const ConvDescriptors_t &, ConvWorkspace_t &, size_t batchSize, size_t inputHeight, size_t inputWidth, size_t depth, size_t height, size_t width, size_t filterDepth, size_t filterHeight, size_t filterWidth, size_t nLocalViews) |
| Perform the complete backward propagation step in a Convolutional Layer. More...
|
|
static void | CalculateConvActivationGradients (Tensor_t &activationGradientsBackward, const Tensor_t &df, const Matrix_t &weights, size_t batchSize, size_t inputHeight, size_t inputWidth, size_t depth, size_t height, size_t width, size_t filterDepth, size_t filterHeight, size_t filterWidth) |
| Utility function for calculating the activation gradients of the layer before the convolutional layer. More...
|
|
static void | CalculateConvWeightGradients (Matrix_t &weightGradients, const Tensor_t &df, const Tensor_t &activations_backward, size_t batchSize, size_t inputHeight, size_t inputWidth, size_t depth, size_t height, size_t width, size_t filterDepth, size_t filterHeight, size_t filterWidth, size_t nLocalViews) |
| Utility function for calculating the weight gradients of the convolutional layer. More...
|
|
static void | CalculateConvBiasGradients (Matrix_t &biasGradients, const Tensor_t &df, size_t batchSize, size_t depth, size_t nLocalViews) |
| Utility function for calculating the bias gradients of the convolutional layer. More...
|
|
|
static void | Downsample (Tensor_t &A, Tensor_t &B, const Tensor_t &C, const PoolingDescriptors_t &, PoolingWorkspace_t &, size_t imgHeight, size_t imgWidth, size_t fltHeight, size_t fltWidth, size_t strideRows, size_t strideCols) |
| Downsample the matrix C to the matrix A , using max operation, such that the winning indices are stored in matrix B . More...
|
|
|
static void | MaxPoolLayerBackward (Tensor_t &activationGradientsBackward, const Tensor_t &activationGradients, const Tensor_t &indexMatrix, const Tensor_t &, const Tensor_t &, const PoolingDescriptors_t &, PoolingWorkspace_t &, size_t imgHeight, size_t imgWidth, size_t fltHeight, size_t fltWidth, size_t strideRows, size_t strideCols, size_t nLocalViews) |
| Perform the complete backward propagation step in a Pooling Layer. More...
|
|
|
static void | Reshape (Matrix_t &A, const Matrix_t &B) |
| Transform the matrix B to a matrix with different dimensions A . More...
|
|
static void | Flatten (Tensor_t &A, const Tensor_t &B) |
| Flattens the tensor B , such that each matrix, is stretched in one row, resulting with a matrix A . More...
|
|
static void | Deflatten (Tensor_t &A, const Tensor_t &B) |
| Transforms each row of B to a matrix and stores it in the tensor B . More...
|
|
static void | Rearrange (Tensor_t &out, const Tensor_t &in) |
| Rearrage data accoring to time fill B x T x D out with T x B x D matrix in. More...
|
|
static Matrix_t & | RecurrentLayerBackward (Matrix_t &state_gradients_backward, Matrix_t &input_weight_gradients, Matrix_t &state_weight_gradients, Matrix_t &bias_gradients, Matrix_t &df, const Matrix_t &state, const Matrix_t &weights_input, const Matrix_t &weights_state, const Matrix_t &input, Matrix_t &input_gradient) |
| Backward pass for Recurrent Networks. More...
|
|
|
Additional arithmetic on CUDA matrices used to implement the low-level interface.
|
static void | Multiply (Matrix_t &C, const Matrix_t &A, const Matrix_t &B) |
| Standard multiplication of two matrices A and B with the result being written into C. More...
|
|
static void | TransposeMultiply (Matrix_t &output, const Matrix_t &input, const Matrix_t &Weights, Scalar_t alpha=1.0, Scalar_t beta=0.) |
| Matrix multiplication of two matrices A and B^T (transposed) with the result being written into C. More...
|
|
static void | Hadamard (Tensor_t &A, const Tensor_t &B) |
| In-place Hadamard (element-wise) product of matrices A and B with the result being written into A . More...
|
|
static void | Hadamard (Matrix_t &A, const Matrix_t &B) |
|
static void | SumColumns (Matrix_t &B, const Matrix_t &A, Scalar_t alpha=1.0, Scalar_t beta=0.) |
| Sum columns of (m x n) matrixx A and write the results into the first m elements in A . More...
|
|
static Scalar_t | Sum (const Matrix_t &A) |
| Compute the sum of all elements in A . More...
|
|
static bool | AlmostEquals (const Matrix_t &A, const Matrix_t &B, double epsilon=0.1) |
| Check two matrices for equality, taking floating point arithmetic errors into account. More...
|
|
static void | ConstAdd (Matrix_t &A, Scalar_t beta) |
| Add the constant beta to all the elements of matrix A and write the result into A . More...
|
|
static void | ConstMult (Matrix_t &A, Scalar_t beta) |
| Multiply the constant beta to all the elements of matrix A and write the result into A . More...
|
|
static void | ReciprocalElementWise (Matrix_t &A) |
| Reciprocal each element of the matrix A and write the result into A . More...
|
|
static void | SquareElementWise (Matrix_t &A) |
| Square each element of the matrix A and write the result into A . More...
|
|
static void | SqrtElementWise (Matrix_t &A) |
| Square root each element of the matrix A and write the result into A . More...
|
|
static void | AdamUpdate (Matrix_t &A, const Matrix_t &M, const Matrix_t &V, Scalar_t alpha, Scalar_t eps) |
|
static void | AdamUpdateFirstMom (Matrix_t &A, const Matrix_t &B, Scalar_t beta) |
|
static void | AdamUpdateSecondMom (Matrix_t &A, const Matrix_t &B, Scalar_t beta) |
|
static void | PrintTensor (const Tensor_t &A, const std::string name="Cuda-tensor", bool=false) |
|
static void | SumRows (Matrix_t &B, const Matrix_t &A) |
| extra functions defined only for CPU architecture !!! More...
|
|