27#ifndef TMVA_DNN_ADAGRAD
28#define TMVA_DNN_ADAGRAD
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;
53 std::vector<std::vector<Matrix_t>>
55 std::vector<std::vector<Matrix_t>>
57 std::vector<std::vector<Matrix_t>>
59 std::vector<std::vector<Matrix_t>>
89template <
typename Architecture_t,
typename Layer_t,
typename DeepNet_t>
93 std::vector<Layer_t *> &layers =
deepNet.GetLayers();
118 Architecture_t::CreateWeightTensors(
fWorkWeightTensor[i], layers[i]->GetWeights());
119 Architecture_t::CreateWeightTensors(
fWorkBiasTensor[i], layers[i]->GetBiases());
125template <
typename Architecture_t,
typename Layer_t,
typename DeepNet_t>
157template <
typename Architecture_t,
typename Layer_t,
typename DeepNet_t>
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.
void UpdateWeights(size_t layerIndex, std::vector< Matrix_t > &weights, const std::vector< Matrix_t > &weightGradients)
Update the weights, given the current weight gradients.
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< std::vector< Matrix_t > > & GetPastSquaredBiasGradients()
std::vector< std::vector< Matrix_t > > fPastSquaredBiasGradients
The sum of the square of the past bias gradients associated with the deep net.
Scalar_t GetEpsilon() const
Getters.
TAdagrad(DeepNet_t &deepNet, Scalar_t learningRate=0.01, Scalar_t epsilon=1e-8)
Constructor.
std::vector< std::vector< Matrix_t > > fPastSquaredWeightGradients
The sum of the square of the past weight gradients associated with the deep net.
typename Architecture_t::Matrix_t Matrix_t
typename Architecture_t::Scalar_t Scalar_t
Scalar_t fEpsilon
The Smoothing term used to avoid division by zero.
std::vector< std::vector< Matrix_t > > & GetPastSquaredWeightGradients()
std::vector< Matrix_t > & GetPastSquaredBiasGradientsAt(size_t i)
std::vector< std::vector< Matrix_t > > fWorkWeightTensor
working tensor used to keep a temporary copy of weights or weight gradients
std::vector< std::vector< Matrix_t > > fWorkBiasTensor
working tensor used to keep a temporary copy of bias or bias gradients
~TAdagrad()=default
Destructor.
std::vector< Matrix_t > & GetPastSquaredWeightGradientsAt(size_t i)
create variable transformations