27#ifndef TMVA_DNN_RMSPROP 
   28#define TMVA_DNN_RMSPROP 
   43template <
typename Architecture_t, 
typename Layer_t = VGeneralLayer<Architecture_t>,
 
   44          typename DeepNet_t = TDeepNet<Architecture_t, Layer_t>>
 
   47   using Matrix_t = 
typename Architecture_t::Matrix_t;
 
   48   using Scalar_t = 
typename Architecture_t::Scalar_t;
 
   54   std::vector<std::vector<Matrix_t>>
 
   56   std::vector<std::vector<Matrix_t>>
 
   61   std::vector<std::vector<Matrix_t>>
 
   63   std::vector<std::vector<Matrix_t>>
 
   65   std::vector<std::vector<Matrix_t>>
 
   67   std::vector<std::vector<Matrix_t>>
 
 
  106template <
typename Architecture_t, 
typename Layer_t, 
typename DeepNet_t>
 
  112   std::vector<Layer_t *> &layers = 
deepNet.GetLayers();
 
  127      Architecture_t::CreateWeightTensors(
fWeightUpdates[i], layers[i]->GetWeights());
 
  137      Architecture_t::CreateWeightTensors( 
fBiasUpdates[i], layers[i]->GetBiases()); 
 
  144      Architecture_t::CreateWeightTensors(
fWorkBiasTensor1[i], layers[i]->GetBiases());
 
  146      Architecture_t::CreateWeightTensors(
fWorkBiasTensor2[i], layers[i]->GetBiases());
 
 
  151template <
typename Architecture_t, 
typename Layer_t, 
typename DeepNet_t>
 
  175      auto &dummy = fWorkWeightTensor2[
layerIndex][k]; 
 
  177      Architecture_t::ConstAdd(dummy, this->GetEpsilon());
 
  178      Architecture_t::SqrtElementWise(dummy);
 
  179      Architecture_t::ReciprocalElementWise(dummy);
 
  183      Architecture_t::ScaleAdd(
accumulation, dummy, this->GetLearningRate());
 
  189   for (
size_t i = 0; i < weights.size(); i++) {
 
 
  195template <
typename Architecture_t, 
typename Layer_t, 
typename DeepNet_t>
 
  218      auto &dummy = fWorkBiasTensor2[
layerIndex][k]; 
 
  221      Architecture_t::ConstAdd(dummy, this->GetEpsilon());
 
  222      Architecture_t::SqrtElementWise(dummy);
 
  223      Architecture_t::ReciprocalElementWise(dummy);
 
  227      Architecture_t::ScaleAdd(
accumulation, dummy, this->GetLearningRate());
 
  233   for (
size_t i = 0; i < 
biases.size(); i++) {
 
 
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Scalar_t fRho
The Rho constant used by the optimizer.
typename Architecture_t::Scalar_t Scalar_t
void UpdateWeights(size_t layerIndex, std::vector< Matrix_t > &weights, const std::vector< Matrix_t > &weightGradients)
Update the weights, given the current weight gradients.
~TRMSProp()=default
Destructor.
std::vector< Matrix_t > & GetPastSquaredWeightGradientsAt(size_t i)
std::vector< std::vector< Matrix_t > > fWorkBiasTensor2
working tensor used to keep a temporary copy of bias or bias gradients
std::vector< std::vector< Matrix_t > > fPastSquaredWeightGradients
The sum of the square of the past weight gradients associated with the deep net.
std::vector< std::vector< Matrix_t > > & GetBiasUpdates()
std::vector< std::vector< Matrix_t > > fWorkWeightTensor2
working tensor used to keep a temporary copy of weights or weight gradients
Scalar_t GetEpsilon() const
std::vector< std::vector< Matrix_t > > fWorkBiasTensor1
working tensor used to keep a temporary copy of bias or bias gradients
Scalar_t fMomentum
The momentum used for training.
std::vector< std::vector< Matrix_t > > & GetPastSquaredBiasGradients()
Scalar_t fEpsilon
The Smoothing term used to avoid division by zero.
TRMSProp(DeepNet_t &deepNet, Scalar_t learningRate=0.001, Scalar_t momentum=0.0, Scalar_t rho=0.9, Scalar_t epsilon=1e-7)
Constructor.
std::vector< std::vector< Matrix_t > > fPastSquaredBiasGradients
The sum of the square of the past bias gradients associated with the deep net.
std::vector< std::vector< Matrix_t > > fWeightUpdates
The accumulation of the past Weights for performing updates.
typename Architecture_t::Matrix_t Matrix_t
void UpdateBiases(size_t layerIndex, std::vector< Matrix_t > &biases, const std::vector< Matrix_t > &biasGradients)
Update the biases, given the current bias gradients.
std::vector< Matrix_t > & GetBiasUpdatesAt(size_t i)
std::vector< std::vector< Matrix_t > > & GetWeightUpdates()
std::vector< std::vector< Matrix_t > > fWorkWeightTensor1
working tensor used to keep a temporary copy of weights or weight gradients
std::vector< Matrix_t > & GetWeightUpdatesAt(size_t i)
std::vector< std::vector< Matrix_t > > & GetPastSquaredWeightGradients()
std::vector< std::vector< Matrix_t > > fBiasUpdates
The accumulation of the past Biases for performing updates.
Scalar_t GetMomentum() const
Getters.
std::vector< Matrix_t > & GetPastSquaredBiasGradientsAt(size_t i)
create variable transformations