input_shape_visitor.hpp
Go to the documentation of this file.
1 
15 #ifndef MLPACK_METHODS_ANN_VISITOR_INPUT_SHAPE_VISITOR_HPP
16 #define MLPACK_METHODS_ANN_VISITOR_INPUT_SHAPE_VISITOR_HPP
17 
20 
21 #include <boost/variant.hpp>
22 
23 namespace mlpack {
24 namespace ann {
25 
29 class InShapeVisitor : public boost::static_visitor<size_t>
30 {
31  public:
33  template<typename LayerType>
34  size_t operator()(LayerType* layer) const;
35 
36  size_t operator()(MoreTypes layer) const;
37 
38  private:
40  template<typename T>
41  typename std::enable_if<
42  !HasInputShapeCheck<T>::value, size_t>::type
43  LayerInputShape(T* layer) const;
44 
46  template<typename T>
47  typename std::enable_if<
48  HasInputShapeCheck<T>::value, size_t>::type
49  LayerInputShape(T* layer) const;
50 };
51 
52 } // namespace ann
53 } // namespace mlpack
54 
55 // Include implementation.
56 #include "input_shape_visitor_impl.hpp"
57 
58 #endif
boost::variant< Linear3D< arma::mat, arma::mat, NoRegularizer > *, LpPooling< arma::mat, arma::mat > *, PixelShuffle< arma::mat, arma::mat > *, 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 > *, ISRLU< arma::mat, arma::mat > *> MoreTypes
Linear algebra utility functions, generally performed on matrices or vectors.
InShapeVisitor returns the input shape a Layer expects.
size_t operator()(LayerType *layer) const
Return the input shape of layer.