mlpack 3.4.2
reset_cell_visitor.hpp
Go to the documentation of this file.
1
12#ifndef MLPACK_METHODS_ANN_VISITOR_RESET_CELL_VISITOR_HPP
13#define MLPACK_METHODS_ANN_VISITOR_RESET_CELL_VISITOR_HPP
14
17
18#include <boost/variant.hpp>
19
20namespace mlpack {
21namespace ann {
22
26class ResetCellVisitor : public boost::static_visitor<void>
27{
28 public:
30 ResetCellVisitor(const size_t size);
31
33 template<typename LayerType>
34 void operator()(LayerType* layer) const;
35
36 void operator()(MoreTypes layer) const;
37
38 private:
39 size_t size;
40
43 template<typename T>
44 typename std::enable_if<
45 HasResetCellCheck<T, void(T::*)(const size_t)>::value, void>::type
46 ResetCell(T* layer) const;
47
49 // the Reset() or Model() function.
50 template<typename T>
51 typename std::enable_if<
52 !HasResetCellCheck<T, void(T::*)(const size_t)>::value, void>::type
53 ResetCell(T* layer) const;
54};
55
56} // namespace ann
57} // namespace mlpack
58
59// Include implementation.
60#include "reset_cell_visitor_impl.hpp"
61
62#endif
ResetCellVisitor executes the ResetCell() function.
ResetCellVisitor(const size_t size)
Reset the cell using the given size.
void operator()(LayerType *layer) const
Execute the ResetCell() function.
void operator()(MoreTypes layer) const
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.
Definition: cv.hpp:1