13#ifndef MLPACK_METHODS_ANN_VISITOR_GRADIENT_SET_VISITOR_HPP
14#define MLPACK_METHODS_ANN_VISITOR_GRADIENT_SET_VISITOR_HPP
18#include <boost/variant.hpp>
33 template<
typename LayerType>
47 typename std::enable_if<
48 HasGradientCheck<T, arma::mat&(T::*)()>::value &&
49 !HasModelCheck<T>::value,
size_t>::type
50 LayerGradients(T* layer, arma::mat& input)
const;
54 typename std::enable_if<
55 !HasGradientCheck<T, arma::mat&(T::*)()>::value &&
56 HasModelCheck<T>::value,
size_t>::type
57 LayerGradients(T* layer, arma::mat& input)
const;
62 typename std::enable_if<
63 HasGradientCheck<T, arma::mat&(T::*)()>::value &&
64 HasModelCheck<T>::value,
size_t>::type
65 LayerGradients(T* layer, arma::mat& input)
const;
69 template<
typename T,
typename P>
70 typename std::enable_if<
71 !HasGradientCheck<T, P&(T::*)()>::value &&
72 !HasModelCheck<T>::value,
size_t>::type
73 LayerGradients(T* layer, P& input)
const;
80#include "gradient_set_visitor_impl.hpp"
GradientSetVisitor update the gradient parameter given the gradient set.
size_t operator()(MoreTypes layer) const
GradientSetVisitor(arma::mat &gradient, size_t offset=0)
Update the gradient parameter given the gradient set.
size_t operator()(LayerType *layer) const
Update the gradient parameter.
boost::variant< Linear3D< arma::mat, arma::mat, NoRegularizer > *, Glimpse< arma::mat, arma::mat > *, Highway< arma::mat, arma::mat > *, MultiheadAttention< arma::mat, arma::mat, NoRegularizer > *, Recurrent< arma::mat, arma::mat > *, RecurrentAttention< arma::mat, arma::mat > *, ReinforceNormal< arma::mat, arma::mat > *, Reparametrization< arma::mat, arma::mat > *, Select< arma::mat, arma::mat > *, Sequential< arma::mat, arma::mat, false > *, Sequential< arma::mat, arma::mat, true > *, Subview< arma::mat, arma::mat > *, VRClassReward< arma::mat, arma::mat > *, VirtualBatchNorm< arma::mat, arma::mat > *, RBF< arma::mat, arma::mat, GaussianFunction > *, BaseLayer< GaussianFunction, arma::mat, arma::mat > *, PositionalEncoding< arma::mat, arma::mat > * > MoreTypes
Linear algebra utility functions, generally performed on matrices or vectors.