Logo ROOT  
Reference Guide
TMVA::DNN::TCpu< AReal > Class Template Reference

template<typename AReal = Float_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 62 of file Cpu.h.

Public Types

using ActivationDescriptor_t = DummyDescriptor
 
using AlgorithmBackward_t = DummyConvolutionBwdDataAlgo
 
using AlgorithmDataType_t = DummyDataType
 
using AlgorithmForward_t = DummyConvolutionFwdAlgo
 
using AlgorithmHelper_t = DummyConvolutionBwdFilterAlgo
 
using BNormDescriptors_t = TDNNGenDescriptors< BNormLayer_t >
 
using BNormLayer_t = TBatchNormLayer< TCpu< AReal > >
 
using ConvDescriptors_t = CNN::TCNNDescriptors< ConvLayer_t >
 
using ConvLayer_t = CNN::TConvLayer< TCpu< AReal > >
 
using ConvolutionDescriptor_t = DummyDescriptor
 
using ConvWorkspace_t = CNN::TCNNWorkspace< ConvLayer_t >
 
using DeviceBuffer_t = TCpuBuffer< AReal >
 
using DropoutDescriptor_t = DummyDescriptor
 
using EmptyDescriptor_t = DummyDescriptor
 
using FilterDescriptor_t = DummyDescriptor
 
using HostBuffer_t = TCpuBuffer< AReal >
 
using Matrix_t = TCpuMatrix< AReal >
 
using PoolingDescriptor_t = DummyDescriptor
 
using PoolingDescriptors_t = CNN::TCNNDescriptors< PoolingLayer_t >
 
using PoolingLayer_t = CNN::TMaxPoolLayer< TCpu< AReal > >
 
using PoolingWorkspace_t = CNN::TCNNWorkspace< PoolingLayer_t >
 
using ReduceTensorDescriptor_t = DummyDataType
 
using Scalar_t = AReal
 
using Tensor_t = TCpuTensor< AReal >
 
using TensorDescriptor_t = DummyDescriptor
 

Static Public Member Functions

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 &params, 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 *&)
 
Forward Propagation

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)
 
Backward Propagation (Dense Layers)

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)
 
Activation Functions

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 Scalar_t alpha=1, const Scalar_t 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 Scalar_t alpha=1, const Scalar_t 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

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

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 &)
 
Regularization

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)
 
Initialization

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)
 Truncated normal initialization (Glorot, called also Xavier normal) The values are sample with a normal distribution with stddev = sqrt(2/N_input + N_output) and values larger than 2 * stddev are discarded See Glorot & Bengio, AISTATS 2010 - http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf. More...
 
static void InitializeGlorotUniform (Matrix_t &A)
 Sample from a uniform distribution in range [ -lim,+lim] where lim = sqrt(6/N_in+N_out). More...
 
static TRandomGetRandomGenerator ()
 
static void SetRandomSeed (size_t seed)
 
Dropout
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 *)
 
Batch Normalization Layer Propagation
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 Tensor_t BatchNormLayerReshapeTensor (int axis, const Tensor_t &x)
 
Forward Propagation in Convolutional Layer
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...
 
Backward Propagation in Convolutional Layer
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...
 
Forward Propagation in Max Pooling Layer
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...
 
Backward Propagation in Max Pooling Layer
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...
 
Forward and Backward Propagation in Reshape Layer
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_tRecurrentLayerBackward (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 Functions

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)
 Adam updates. More...
 
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="Cpu-tensor", bool truncate=false)
 

Static Private Attributes

static TRandomfgRandomGen = nullptr
 

#include <TMVA/DNN/Architectures/Cpu.h>

Member Typedef Documentation

◆ ActivationDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ActivationDescriptor_t = DummyDescriptor

Definition at line 74 of file Cpu.h.

◆ AlgorithmBackward_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::AlgorithmBackward_t = DummyConvolutionBwdDataAlgo

Definition at line 83 of file Cpu.h.

◆ AlgorithmDataType_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::AlgorithmDataType_t = DummyDataType

Definition at line 85 of file Cpu.h.

◆ AlgorithmForward_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::AlgorithmForward_t = DummyConvolutionFwdAlgo

Definition at line 82 of file Cpu.h.

◆ AlgorithmHelper_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::AlgorithmHelper_t = DummyConvolutionBwdFilterAlgo

Definition at line 84 of file Cpu.h.

◆ BNormDescriptors_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::BNormDescriptors_t = TDNNGenDescriptors<BNormLayer_t>

Definition at line 91 of file Cpu.h.

◆ BNormLayer_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::BNormLayer_t = TBatchNormLayer<TCpu<AReal> >

Definition at line 90 of file Cpu.h.

◆ ConvDescriptors_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ConvDescriptors_t = CNN::TCNNDescriptors<ConvLayer_t>

Definition at line 94 of file Cpu.h.

◆ ConvLayer_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ConvLayer_t = CNN::TConvLayer<TCpu<AReal> >

Definition at line 93 of file Cpu.h.

◆ ConvolutionDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ConvolutionDescriptor_t = DummyDescriptor

Definition at line 75 of file Cpu.h.

◆ ConvWorkspace_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ConvWorkspace_t = CNN::TCNNWorkspace<ConvLayer_t>

Definition at line 95 of file Cpu.h.

◆ DeviceBuffer_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::DeviceBuffer_t = TCpuBuffer<AReal>

Definition at line 72 of file Cpu.h.

◆ DropoutDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::DropoutDescriptor_t = DummyDescriptor

Definition at line 77 of file Cpu.h.

◆ EmptyDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::EmptyDescriptor_t = DummyDescriptor

Definition at line 88 of file Cpu.h.

◆ FilterDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::FilterDescriptor_t = DummyDescriptor

Definition at line 76 of file Cpu.h.

◆ HostBuffer_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::HostBuffer_t = TCpuBuffer<AReal>

Definition at line 71 of file Cpu.h.

◆ Matrix_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::Matrix_t = TCpuMatrix<AReal>

Definition at line 70 of file Cpu.h.

◆ PoolingDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::PoolingDescriptor_t = DummyDescriptor

Definition at line 79 of file Cpu.h.

◆ PoolingDescriptors_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::PoolingDescriptors_t = CNN::TCNNDescriptors<PoolingLayer_t>

Definition at line 97 of file Cpu.h.

◆ PoolingLayer_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::PoolingLayer_t = CNN::TMaxPoolLayer<TCpu<AReal> >

Definition at line 96 of file Cpu.h.

◆ PoolingWorkspace_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::PoolingWorkspace_t = CNN::TCNNWorkspace<PoolingLayer_t>

Definition at line 98 of file Cpu.h.

◆ ReduceTensorDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::ReduceTensorDescriptor_t = DummyDataType

Definition at line 86 of file Cpu.h.

◆ Scalar_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::Scalar_t = AReal

Definition at line 68 of file Cpu.h.

◆ Tensor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::Tensor_t = TCpuTensor<AReal>

Definition at line 69 of file Cpu.h.

◆ TensorDescriptor_t

template<typename AReal = Float_t>
using TMVA::DNN::TCpu< AReal >::TensorDescriptor_t = DummyDescriptor

Definition at line 80 of file Cpu.h.

Member Function Documentation

◆ ActivationFunctionBackward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::ActivationFunctionBackward ( Tensor_t dX,
const Tensor_t Y,
const Tensor_t dY,
const Tensor_t X,
EActivationFunction  activFunct,
const ActivationDescriptor_t  activationDescr,
const Scalar_t  alpha = 1,
const Scalar_t  beta = 0 
)
static

Computes the gradient of the activation function.

Definition at line 44 of file ActivationFunctions.hxx.

◆ ActivationFunctionForward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::ActivationFunctionForward ( Tensor_t X,
EActivationFunction  activFunct,
const ActivationDescriptor_t  activationDescr,
const double  coef = 0.0,
const Scalar_t  alpha = 1,
const Scalar_t  beta = 0 
)
static

Definition at line 35 of file ActivationFunctions.hxx.

◆ AdamUpdate()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::AdamUpdate ( Matrix_t A,
const Matrix_t M,
const Matrix_t V,
Scalar_t  alpha,
Scalar_t  eps 
)
static

Adam updates.

Definition at line 329 of file Arithmetic.hxx.

◆ AdamUpdateFirstMom()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::AdamUpdateFirstMom ( Matrix_t A,
const Matrix_t B,
Scalar_t  beta 
)
static

Definition at line 343 of file Arithmetic.hxx.

◆ AdamUpdateSecondMom()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::AdamUpdateSecondMom ( Matrix_t A,
const Matrix_t B,
Scalar_t  beta 
)
static

Definition at line 355 of file Arithmetic.hxx.

◆ AddConvBiases()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::AddConvBiases ( Matrix_t output,
const Matrix_t biases 
)
static

Add the biases in the Convolutional Layer.


Definition at line 289 of file Propagation.hxx.

◆ AddL1RegularizationGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::AddL1RegularizationGradients ( Matrix_t A,
const Matrix_t W,
Scalar_t  weightDecay 
)
static

Definition at line 60 of file Regularization.hxx.

◆ AddL2RegularizationGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::AddL2RegularizationGradients ( Matrix_t A,
const Matrix_t W,
Scalar_t  weightDecay 
)
static

Definition at line 132 of file Regularization.hxx.

◆ AddRowWise() [1/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::AddRowWise ( Matrix_t output,
const Matrix_t biases 
)
static

Add the vectors biases row-wise to the matrix output.

◆ AddRowWise() [2/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::AddRowWise ( Tensor_t output,
const Matrix_t biases 
)
inlinestatic

Definition at line 175 of file Cpu.h.

◆ AlmostEquals()

template<typename AReal >
bool TMVA::DNN::TCpu< AReal >::AlmostEquals ( const Matrix_t A,
const Matrix_t B,
double  epsilon = 0.1 
)
static

Check two matrices for equality, taking floating point arithmetic errors into account.

Checks two matrices for element-wise equality.

Template Parameters
ARealAn architecture-specific floating point number type.
Parameters
AThe first matrix.
BThe second matrix.
epsilonEquality tolerance, needed to address floating point arithmetic.
Returns
Whether the two matrices can be considered equal element-wise

Definition at line 187 of file Arithmetic.hxx.

◆ Backward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Perform the complete backward propagation step.

If the provided activationGradientsBackward matrix is not empty, compute the gradients of the objective function with respect to the activations of the previous layer (backward direction). Also compute the weight and the bias gradients. Modifies the values in df and thus produces only a valid result, if it is applied the first time after the corresponding forward propagation has been per- formed.

Definition at line 100 of file Propagation.hxx.

◆ BatchNormLayerBackward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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

Definition at line 835 of file Propagation.hxx.

◆ BatchNormLayerForwardInference()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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  
)
static

During inference the inputs are not normalized using the batch mean but the previously computed at running mean and variance.

Definition at line 794 of file Propagation.hxx.

◆ BatchNormLayerForwardTraining()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

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:

  • a scale factor \gamma gamma
  • an offset \beta beta

Definition at line 709 of file Propagation.hxx.

◆ BatchNormLayerReshapeTensor()

template<typename AReal = Float_t>
TCpuTensor< AFloat > TMVA::DNN::TCpu< AFloat >::BatchNormLayerReshapeTensor ( int  axis,
const Tensor_t x 
)
static

Definition at line 693 of file Propagation.hxx.

◆ CalculateConvActivationGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Utility function for calculating the activation gradients of the layer before the convolutional layer.

Definition at line 425 of file Propagation.hxx.

◆ CalculateConvBiasGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::CalculateConvBiasGradients ( Matrix_t biasGradients,
const Tensor_t df,
size_t  batchSize,
size_t  depth,
size_t  nLocalViews 
)
static

Utility function for calculating the bias gradients of the convolutional layer.

Definition at line 587 of file Propagation.hxx.

◆ CalculateConvWeightGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Utility function for calculating the weight gradients of the convolutional layer.

Definition at line 494 of file Propagation.hxx.

◆ calculateDimension()

template<typename AFloat >
size_t TMVA::DNN::TCpu< AFloat >::calculateDimension ( size_t  imgDim,
size_t  fltDim,
size_t  padding,
size_t  stride 
)
static

Calculate how many neurons "fit" in the output layer, given the input as well as the layer's hyperparameters.

Definition at line 314 of file Propagation.hxx.

◆ ConstAdd()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::ConstAdd ( Matrix_t A,
Scalar_t  beta 
)
static

Add the constant beta to all the elements of matrix A and write the result into A.

Definition at line 288 of file Arithmetic.hxx.

◆ ConstMult()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::ConstMult ( Matrix_t A,
Scalar_t  beta 
)
static

Multiply the constant beta to all the elements of matrix A and write the result into A.

Definition at line 296 of file Arithmetic.hxx.

◆ ConvLayerBackward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Perform the complete backward propagation step in a Convolutional Layer.

If the provided activationGradientsBackward matrix is not empty, compute the gradients of the objective function with respect to the activations of the previous layer (backward direction). Also compute the weight and the bias gradients. Modifies the values in df and thus produces only a valid result, if it is applied the first time after the corresponding forward propagation has been per- formed.

Definition at line 380 of file Propagation.hxx.

◆ ConvLayerForward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::ConvLayerForward ( Tensor_t output,
Tensor_t inputActivationFunc,
const Tensor_t input,
const Matrix_t weights,
const Matrix_t biases,
const DNN::CNN::TConvParams params,
EActivationFunction  activFunc,
Tensor_t ,
const ConvDescriptors_t ,
ConvWorkspace_t  
)
static

Forward propagation in the Convolutional layer.

Definition at line 326 of file Propagation.hxx.

◆ Copy() [1/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::Copy ( Matrix_t B,
const Matrix_t A 
)
static

Definition at line 255 of file Arithmetic.hxx.

◆ Copy() [2/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::Copy ( Tensor_t A,
const Tensor_t B 
)
static

Definition at line 278 of file Arithmetic.hxx.

◆ CopyDiffArch() [1/3]

template<typename AReal >
template<typename AMatrix_t >
void TMVA::DNN::TCpu< AReal >::CopyDiffArch ( Matrix_t B,
const AMatrix_t &  A 
)
static

Definition at line 700 of file Cpu.h.

◆ CopyDiffArch() [2/3]

template<typename AReal >
template<typename AMatrix_t >
void TMVA::DNN::TCpu< AReal >::CopyDiffArch ( std::vector< Matrix_t > &  A,
const std::vector< AMatrix_t > &  B 
)
static

Definition at line 734 of file Cpu.h.

◆ CopyDiffArch() [3/3]

template<typename AReal >
template<typename ATensor_t >
void TMVA::DNN::TCpu< AReal >::CopyDiffArch ( Tensor_t A,
const ATensor_t &  B 
)
static

Definition at line 712 of file Cpu.h.

◆ CreateTensor() [1/2]

template<typename AReal = Float_t>
static Tensor_t TMVA::DNN::TCpu< AReal >::CreateTensor ( DeviceBuffer_t  buffer,
size_t  n,
size_t  c,
size_t  h,
size_t  w 
)
inlinestatic

Definition at line 105 of file Cpu.h.

◆ CreateTensor() [2/2]

template<typename AReal = Float_t>
static Tensor_t TMVA::DNN::TCpu< AReal >::CreateTensor ( size_t  n,
size_t  c,
size_t  h,
size_t  w 
)
inlinestatic

Definition at line 102 of file Cpu.h.

◆ CreateWeightTensors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::CreateWeightTensors ( std::vector< Matrix_t > &  newWeights,
const std::vector< Matrix_t > &  weights 
)
inlinestatic

Definition at line 110 of file Cpu.h.

◆ CrossEntropy()

template<typename AReal = Float_t>
AFloat TMVA::DNN::TCpu< AFloat >::CrossEntropy ( const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Sigmoid transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net.

Definition at line 77 of file LossFunctions.hxx.

◆ CrossEntropyGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::CrossEntropyGradients ( Matrix_t dY,
const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Definition at line 113 of file LossFunctions.hxx.

◆ Deflatten()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Deflatten ( Tensor_t A,
const Tensor_t B 
)
static

Transforms each row of B to a matrix and stores it in the tensor B.

Definition at line 944 of file Propagation.hxx.

◆ Downsample()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Downsample the matrix C to the matrix A, using max operation, such that the winning indices are stored in matrix B.

Definition at line 605 of file Propagation.hxx.

◆ DropoutBackward()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::DropoutBackward ( Tensor_t ,
TDescriptors ,
TWorkspace  
)
inlinestatic

Definition at line 425 of file Cpu.h.

◆ DropoutForward() [1/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::DropoutForward ( Matrix_t A,
Scalar_t  p 
)
inlinestatic

Definition at line 419 of file Cpu.h.

◆ DropoutForward() [2/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::DropoutForward ( Tensor_t A,
TDescriptors descriptors,
TWorkspace workspace,
Scalar_t  p 
)
static

Apply dropout with activation probability p to the given tensor A and scale the result by reciprocal of p.

◆ Flatten()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Flatten ( Tensor_t A,
const Tensor_t B 
)
static

Flattens the tensor B, such that each matrix, is stretched in one row, resulting with a matrix A.

Definition at line 908 of file Propagation.hxx.

◆ FreeConvWorkspace()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::FreeConvWorkspace ( TWorkspace *&  ,
ConvLayer_t  
)
inlinestatic

Only used for certain cudnn on-device memory.

Definition at line 147 of file Cpu.h.

◆ FreePoolDropoutWorkspace()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::FreePoolDropoutWorkspace ( TWorkspace *&  ,
PoolingLayer_t  
)
inlinestatic

Definition at line 148 of file Cpu.h.

◆ Gauss()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Gauss ( Tensor_t B)
static

Definition at line 165 of file ActivationFunctions.hxx.

◆ GaussDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::GaussDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 173 of file ActivationFunctions.hxx.

◆ GetRandomGenerator()

template<typename AFloat >
TRandom & TMVA::DNN::TCpu< AFloat >::GetRandomGenerator
static

Definition at line 35 of file Initialization.hxx.

◆ GetTensorLayout()

template<typename AReal = Float_t>
static TMVA::Experimental::MemoryLayout TMVA::DNN::TCpu< AReal >::GetTensorLayout ( )
inlinestatic

Definition at line 100 of file Cpu.h.

◆ Hadamard() [1/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::Hadamard ( Matrix_t A,
const Matrix_t B 
)
static

Definition at line 110 of file Arithmetic.hxx.

◆ Hadamard() [2/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::Hadamard ( Tensor_t A,
const Tensor_t B 
)
static

In-place Hadamard (element-wise) product of matrices A and B with the result being written into A.

Definition at line 145 of file Arithmetic.hxx.

◆ IdentityDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::IdentityDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 59 of file ActivationFunctions.hxx.

◆ Im2col()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Transform the matrix B in local view format, suitable for convolution, and store it in matrix A.

Definition at line 132 of file Propagation.hxx.

◆ Im2colFast()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Im2colFast ( Matrix_t A,
const Matrix_t B,
const std::vector< int > &  V 
)
static

Definition at line 235 of file Propagation.hxx.

◆ Im2colIndices()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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

Definition at line 183 of file Propagation.hxx.

◆ InitializeActivationDescriptor()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializeActivationDescriptor ( ActivationDescriptor_t ,
EActivationFunction  ,
double  = 0.0 
)
inlinestatic

Definition at line 131 of file Cpu.h.

◆ InitializeBNormDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializeBNormDescriptors ( TDescriptors *&  ,
BNormLayer_t  
)
inlinestatic

Initialize CNN data/operator descriptors.

Not used at the moment.

Definition at line 123 of file Cpu.h.

◆ InitializeConvDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializeConvDescriptors ( TDescriptors *&  ,
ConvLayer_t  
)
inlinestatic

Definition at line 126 of file Cpu.h.

◆ InitializeConvWorkspace()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializeConvWorkspace ( TWorkspace *&  ,
TDescriptors *&  ,
const DNN::CNN::TConvParams ,
ConvLayer_t  
)
inlinestatic

Definition at line 138 of file Cpu.h.

◆ InitializeGauss()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeGauss ( Matrix_t A)
static

Definition at line 43 of file Initialization.hxx.

◆ InitializeGlorotNormal()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeGlorotNormal ( Matrix_t A)
static

Truncated normal initialization (Glorot, called also Xavier normal) The values are sample with a normal distribution with stddev = sqrt(2/N_input + N_output) and values larger than 2 * stddev are discarded See Glorot & Bengio, AISTATS 2010 - http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf.

Definition at line 82 of file Initialization.hxx.

◆ InitializeGlorotUniform()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeGlorotUniform ( Matrix_t A)
static

Sample from a uniform distribution in range [ -lim,+lim] where lim = sqrt(6/N_in+N_out).

This initialization is also called Xavier uniform see Glorot & Bengio, AISTATS 2010 - http://jmlr.org/proceedings/papers/v9/glorot10a/glorot10a.pdf

Definition at line 112 of file Initialization.hxx.

◆ InitializeIdentity()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeIdentity ( Matrix_t A)
static

Definition at line 130 of file Initialization.hxx.

◆ InitializePoolDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializePoolDescriptors ( TDescriptors *&  ,
PoolingLayer_t  
)
inlinestatic

Definition at line 128 of file Cpu.h.

◆ InitializePoolDropoutWorkspace()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::InitializePoolDropoutWorkspace ( TWorkspace *&  ,
TDescriptors *&  ,
const DNN::CNN::TConvParams ,
PoolingLayer_t  
)
inlinestatic

Definition at line 142 of file Cpu.h.

◆ InitializeUniform()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeUniform ( Matrix_t A)
static

Definition at line 58 of file Initialization.hxx.

◆ InitializeZero()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::InitializeZero ( Matrix_t A)
static

Definition at line 150 of file Initialization.hxx.

◆ L1Regularization()

template<typename AReal = Float_t>
AFloat TMVA::DNN::TCpu< AFloat >::L1Regularization ( const Matrix_t W)
static

Definition at line 27 of file Regularization.hxx.

◆ L2Regularization()

template<typename AReal = Float_t>
AFloat TMVA::DNN::TCpu< AFloat >::L2Regularization ( const Matrix_t W)
static

Definition at line 98 of file Regularization.hxx.

◆ MaxPoolLayerBackward()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::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 
)
static

Perform the complete backward propagation step in a Pooling Layer.

Based on the winning idices stored in the index matrix, it just forwards the actiovation gradients to the previous layer.

Definition at line 650 of file Propagation.hxx.

◆ MeanSquaredError()

template<typename AReal = Float_t>
AFloat TMVA::DNN::TCpu< AFloat >::MeanSquaredError ( const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Definition at line 27 of file LossFunctions.hxx.

◆ MeanSquaredErrorGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::MeanSquaredErrorGradients ( Matrix_t dY,
const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Definition at line 54 of file LossFunctions.hxx.

◆ Multiply()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::Multiply ( Matrix_t C,
const Matrix_t A,
const Matrix_t B 
)
static

Standard multiplication of two matrices A and B with the result being written into C.

Definition at line 39 of file Arithmetic.hxx.

◆ MultiplyTranspose() [1/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::MultiplyTranspose ( Matrix_t output,
const Matrix_t input,
const Matrix_t weights 
)
static

Matrix-multiply input with the transpose of \pweights and write the results into output.

◆ MultiplyTranspose() [2/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::MultiplyTranspose ( Tensor_t output,
const Tensor_t input,
const Matrix_t weights 
)
inlinestatic

Definition at line 166 of file Cpu.h.

◆ PrepareInternals()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::PrepareInternals ( Tensor_t )
inlinestatic

Dummy placeholder - preparation is currently only required for the CUDA architecture.

Definition at line 502 of file Cpu.h.

◆ PrintTensor()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AReal >::PrintTensor ( const Tensor_t A,
const std::string  name = "Cpu-tensor",
bool  truncate = false 
)
static

Definition at line 742 of file Cpu.h.

◆ Rearrange()

template<typename AFloat >
void TMVA::DNN::TCpu< AFloat >::Rearrange ( Tensor_t out,
const Tensor_t in 
)
static

Rearrage data accoring to time fill B x T x D out with T x B x D matrix in.

Definition at line 968 of file Propagation.hxx.

◆ ReciprocalElementWise()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::ReciprocalElementWise ( Matrix_t A)
static

Reciprocal each element of the matrix A and write the result into A.

Definition at line 304 of file Arithmetic.hxx.

◆ RecurrentLayerBackward()

template<typename AReal = Float_t>
auto TMVA::DNN::TCpu< AFloat >::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 
)
static

Backward pass for Recurrent Networks.

Definition at line 27 of file RecurrentPropagation.hxx.

◆ ReleaseBNormDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::ReleaseBNormDescriptors ( TDescriptors *&  )
inlinestatic

Definition at line 136 of file Cpu.h.

◆ ReleaseConvDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::ReleaseConvDescriptors ( TDescriptors *&  )
inlinestatic

Release CNN data/operator descriptors.

Not used at the moment.

Definition at line 134 of file Cpu.h.

◆ ReleaseDescriptor()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::ReleaseDescriptor ( ActivationDescriptor_t )
inlinestatic

Definition at line 150 of file Cpu.h.

◆ ReleasePoolDescriptors()

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::ReleasePoolDescriptors ( TDescriptors *&  )
inlinestatic

Definition at line 135 of file Cpu.h.

◆ Relu()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Relu ( Tensor_t B)
static

Definition at line 68 of file ActivationFunctions.hxx.

◆ ReluDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::ReluDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 76 of file ActivationFunctions.hxx.

◆ Reshape()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Reshape ( Matrix_t A,
const Matrix_t B 
)
static

Transform the matrix B to a matrix with different dimensions A.

Definition at line 893 of file Propagation.hxx.

◆ RotateWeights()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::RotateWeights ( Matrix_t A,
const Matrix_t B,
size_t  filterDepth,
size_t  filterHeight,
size_t  filterWidth,
size_t  numFilters 
)
static

Rotates the matrix B, which is representing a weights, and stores them in the matrix A.

Definition at line 273 of file Propagation.hxx.

◆ ScaleAdd() [1/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::ScaleAdd ( Matrix_t A,
const Matrix_t B,
Scalar_t  beta = 1.0 
)
static

Adds a the elements in matrix B scaled by c to the elements in the matrix A.

This is required for the weight update in the gradient descent step.

Definition at line 234 of file Arithmetic.hxx.

◆ ScaleAdd() [2/2]

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::ScaleAdd ( Tensor_t A,
const Tensor_t B,
Scalar_t  beta = 1.0 
)
static

Above functions extended to vectors.

Definition at line 265 of file Arithmetic.hxx.

◆ SetRandomSeed()

template<typename AFloat >
void TMVA::DNN::TCpu< AFloat >::SetRandomSeed ( size_t  seed)
static

Definition at line 29 of file Initialization.hxx.

◆ Sigmoid() [1/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::Sigmoid ( Matrix_t YHat,
const Matrix_t  
)
static

◆ Sigmoid() [2/2]

template<typename AReal = Float_t>
static void TMVA::DNN::TCpu< AReal >::Sigmoid ( Tensor_t B)
static

◆ SigmoidDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SigmoidDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 93 of file ActivationFunctions.hxx.

◆ Softmax()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Softmax ( Matrix_t YHat,
const Matrix_t  
)
static

Definition at line 33 of file OutputFunctions.hxx.

◆ SoftmaxCrossEntropy()

template<typename AReal = Float_t>
AFloat TMVA::DNN::TCpu< AFloat >::SoftmaxCrossEntropy ( const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Softmax transformation is implicitly applied, thus output should hold the linear activations of the last layer in the net.

Definition at line 137 of file LossFunctions.hxx.

◆ SoftmaxCrossEntropyGradients()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SoftmaxCrossEntropyGradients ( Matrix_t dY,
const Matrix_t Y,
const Matrix_t output,
const Matrix_t weights 
)
static

Definition at line 173 of file LossFunctions.hxx.

◆ SoftSign()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SoftSign ( Tensor_t B)
static

Definition at line 144 of file ActivationFunctions.hxx.

◆ SoftSignDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SoftSignDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 152 of file ActivationFunctions.hxx.

◆ SqrtElementWise()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::SqrtElementWise ( Matrix_t A)
static

Square root each element of the matrix A and write the result into A.

Definition at line 320 of file Arithmetic.hxx.

◆ SquareElementWise()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::SquareElementWise ( Matrix_t A)
static

Square each element of the matrix A and write the result into A.

Definition at line 312 of file Arithmetic.hxx.

◆ Sum()

template<typename AReal = Float_t>
static Scalar_t TMVA::DNN::TCpu< AReal >::Sum ( const Matrix_t A)
static

Compute the sum of all elements in A.

◆ SumColumns()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::SumColumns ( Matrix_t B,
const Matrix_t A,
Scalar_t  alpha = 1.0,
Scalar_t  beta = 0. 
)
static

Sum columns of (m x n) matrixx A and write the results into the first m elements in A.

Definition at line 205 of file Arithmetic.hxx.

◆ SymmetricRelu()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SymmetricRelu ( Tensor_t B)
static

Definition at line 125 of file ActivationFunctions.hxx.

◆ SymmetricReluDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::SymmetricReluDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 133 of file ActivationFunctions.hxx.

◆ Tanh()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::Tanh ( Tensor_t B)
static

Definition at line 105 of file ActivationFunctions.hxx.

◆ TanhDerivative()

template<typename AReal = Float_t>
void TMVA::DNN::TCpu< AFloat >::TanhDerivative ( Tensor_t B,
const Tensor_t A 
)
static

Definition at line 113 of file ActivationFunctions.hxx.

◆ TransposeMultiply()

template<typename AReal >
void TMVA::DNN::TCpu< AReal >::TransposeMultiply ( Matrix_t output,
const Matrix_t input,
const Matrix_t Weights,
Scalar_t  alpha = 1.0,
Scalar_t  beta = 0. 
)
static

Matrix multiplication of two matrices A and B^T (transposed) with the result being written into C.

Definition at line 74 of file Arithmetic.hxx.

Member Data Documentation

◆ fgRandomGen

template<typename AFloat_t >
TRandom * TMVA::DNN::TCpu< AFloat_t >::fgRandomGen = nullptr
staticprivate

Definition at line 65 of file Cpu.h.


The documentation for this class was generated from the following files: