template<typename AReal = Real_t>
class TMVA::DNN::TCpu< AReal >
The TCpu architecture class.
Low-level interface class for multi-threaded CPU architectures. Contains as public types the declaration of the scalar, matrix and data loader types for this architecture as well as the remaining functions in the low-level interface in the form of static members.
Definition at line 37 of file Cpu.h.
|
|
Low-level functions required for the forward propagation of activations through the network.
|
static void | MultiplyTranspose (TCpuMatrix< Scalar_t > &output, const TCpuMatrix< Scalar_t > &input, const TCpuMatrix< Scalar_t > &weights) |
| Matrix-multiply input with the transpose of and write the results into output . More...
|
|
static void | AddRowWise (TCpuMatrix< Scalar_t > &output, const TCpuMatrix< Scalar_t > &biases) |
| Add the vectors biases row-wise to the matrix output. More...
|
|
|
Low-level functions required for the forward propagation of activations through the network.
|
static void | Backward (TCpuMatrix< Scalar_t > &activationGradientsBackward, TCpuMatrix< Scalar_t > &weightGradients, TCpuMatrix< Scalar_t > &biasGradients, TCpuMatrix< Scalar_t > &df, const TCpuMatrix< Scalar_t > &activationGradients, const TCpuMatrix< Scalar_t > &weights, const TCpuMatrix< Scalar_t > &activationBackward) |
| Perform the complete backward propagation step. More...
|
|
static void | ScaleAdd (TCpuMatrix< Scalar_t > &A, const TCpuMatrix< Scalar_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 (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
|
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 | IdentityDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | Relu (TCpuMatrix< Scalar_t > &B) |
|
static void | ReluDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | Sigmoid (TCpuMatrix< Scalar_t > &B) |
|
static void | SigmoidDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | Tanh (TCpuMatrix< Scalar_t > &B) |
|
static void | TanhDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | SymmetricRelu (TCpuMatrix< Scalar_t > &B) |
|
static void | SymmetricReluDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | SoftSign (TCpuMatrix< Scalar_t > &B) |
|
static void | SoftSignDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
|
static void | Gauss (TCpuMatrix< Scalar_t > &B) |
|
static void | GaussDerivative (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_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 TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
|
static void | MeanSquaredErrorGradients (TCpuMatrix< Scalar_t > &dY, const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
|
static Scalar_t | CrossEntropy (const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
| Sigmoid transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net. More...
|
|
static void | CrossEntropyGradients (TCpuMatrix< Scalar_t > &dY, const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
|
static Scalar_t | SoftmaxCrossEntropy (const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
| Softmax transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net. More...
|
|
static void | SoftmaxCrossEntropyGradients (TCpuMatrix< Scalar_t > &dY, const TCpuMatrix< Scalar_t > &Y, const TCpuMatrix< Scalar_t > &output) |
|
|
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 (TCpuMatrix< Scalar_t > &YHat, const TCpuMatrix< Scalar_t > &) |
|
static void | Softmax (TCpuMatrix< Scalar_t > &YHat, const TCpuMatrix< Scalar_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 TCpuMatrix< Scalar_t > &W) |
|
static void | AddL1RegularizationGradients (TCpuMatrix< Scalar_t > &A, const TCpuMatrix< Scalar_t > &W, Scalar_t weightDecay) |
|
static Scalar_t | L2Regularization (const TCpuMatrix< Scalar_t > &W) |
|
static void | AddL2RegularizationGradients (TCpuMatrix< Scalar_t > &A, const TCpuMatrix< Scalar_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 (TCpuMatrix< Scalar_t > &A) |
|
static void | InitializeUniform (TCpuMatrix< Scalar_t > &A) |
|
static void | InitializeIdentity (TCpuMatrix< Scalar_t > &A) |
|
static void | InitializeZero (TCpuMatrix< Scalar_t > &A) |
|
|
static void | Dropout (TCpuMatrix< Scalar_t > &A, Scalar_t p) |
| Apply dropout with activation probability p to the given matrix A and scale the result by reciprocal of p . More...
|
|
|
Additional arithmetic on CUDA matrices used to implement the low-level interface.
|
static void | Multiply (TCpuMatrix< Scalar_t > &C, const TCpuMatrix< Scalar_t > &A, const TCpuMatrix< Scalar_t > &B) |
| Standard multiplication of two matrices A and B with the result being written into C. More...
|
|
static void | TransposeMultiply (TCpuMatrix< Scalar_t > &output, const TCpuMatrix< Scalar_t > &input, const TCpuMatrix< Scalar_t > &Weights) |
| Matrix multiplication of two matrices A and B^T (transposed) with the result being written into C. More...
|
|
static void | Hadamard (TCpuMatrix< Scalar_t > &A, const TCpuMatrix< Scalar_t > &B) |
| In-place Hadamard (element-wise) product of matrices A and B with the result being written into A . More...
|
|
static void | SumColumns (TCpuMatrix< Scalar_t > &B, const TCpuMatrix< Scalar_t > &A) |
| 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 TCpuMatrix< Scalar_t > &A) |
| Compute the sum of all elements in A . More...
|
|