18#ifndef TMVA_DNN_FUNCTIONS
19#define TMVA_DNN_FUNCTIONS
95template<
typename Architecture_t>
96inline void evaluate(
typename Architecture_t::Tensor_t &
A,
120template<
typename Architecture_t>
123 const typename Architecture_t::Tensor_t &
A)
150template<
typename Architecture_t>
151inline void evaluate(
typename Architecture_t::Matrix_t &
A,
153 const typename Architecture_t::Matrix_t &X)
173template <
typename Architecture_t>
175 const typename Architecture_t::Matrix_t &
output,
const typename Architecture_t::Matrix_t &weights)
176 ->
decltype(Architecture_t::CrossEntropy(Y,
output, weights))
190template <
typename Architecture_t>
192 const typename Architecture_t::Matrix_t &Y,
193 const typename Architecture_t::Matrix_t &
output,
194 const typename Architecture_t::Matrix_t &weights)
201 Architecture_t::SoftmaxCrossEntropyGradients(dY, Y,
output, weights);
213template<
typename Architecture_t>
216->
decltype(Architecture_t::L1Regularization(
A))
223 return Architecture_t::L1Regularization(
A);
225 return Architecture_t::L2Regularization(
A);
233template<
typename Architecture_t>
235 const typename Architecture_t::Matrix_t &W,
244 Architecture_t::AddL1RegularizationGradients(
A, W,
weightDecay);
247 Architecture_t::AddL2RegularizationGradients(
A, W,
weightDecay);
257template<
typename Architecture_t>
#define R(a, b, c, d, e, f, g, h, i)
void Copy(void *source, void *dest)
std::shared_ptr< std::function< double(double)> > Tanh
EOptimizer
Enum representing the optimizer used for training.
void addRegularizationGradients(typename Architecture_t::Matrix_t &A, const typename Architecture_t::Matrix_t &W, typename Architecture_t::Scalar_t weightDecay, ERegularization R)
Add the regularization gradient corresponding to weight matrix W, to the matrix A.
EOutputFunction
Enum that represents output functions.
double weightDecay(double error, ItWeight itWeight, ItWeight itWeightEnd, double factorWeightDecay, EnumRegularization eRegularization)
compute the weight decay for regularization (L1 or L2)
void evaluate(typename Architecture_t::Tensor_t &A, EActivationFunction f)
Apply the given activation function to each value in the given tensor A.
auto regularization(const typename Architecture_t::Matrix_t &A, ERegularization R) -> decltype(Architecture_t::L1Regularization(A))
Evaluate the regularization functional for a given weight matrix.
ERegularization
Enum representing the regularization type applied for a given layer.
EActivationFunction
Enum that represents layer activation functions.
ELossFunction
Enum that represents objective functions for the net, i.e.
std::shared_ptr< std::function< double(double)> > Gauss
std::shared_ptr< std::function< double(double)> > Sigmoid
void evaluateGradients(typename Architecture_t::Matrix_t &dY, ELossFunction f, const typename Architecture_t::Matrix_t &Y, const typename Architecture_t::Matrix_t &output, const typename Architecture_t::Matrix_t &weights)
Compute the gradient of the given output function f for given activations output of the output layer ...
std::shared_ptr< std::function< double(double)> > SoftSign
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
void evaluateDerivative(typename Architecture_t::Tensor_t &B, EActivationFunction f, const typename Architecture_t::Tensor_t &A)
Compute the first partial derivative of the activation function for the values given in tensor A and ...
create variable transformations
static void output(int code)