mlpack
input_shape_visitor_impl.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_METHODS_ANN_VISITOR_INPUT_SHAPE_VISITOR_IMPL_HPP
14 #define MLPACK_METHODS_ANN_VISITOR_INPUT_SHAPE_VISITOR_IMPL_HPP
15 
16 // In case it hasn't been included yet.
17 #include "input_shape_visitor.hpp"
18 
19 namespace mlpack {
20 namespace ann {
21 
23 template<typename LayerType>
24 inline std::size_t InShapeVisitor::operator()(LayerType* layer) const
25 {
26  return LayerInputShape(layer);
27 }
28 
29 inline std::size_t InShapeVisitor::operator()(MoreTypes layer) const
30 {
31  return layer.apply_visitor(*this);
32 }
33 
34 template<typename T>
35 inline typename std::enable_if<
36  !HasInputShapeCheck<T>::value, std::size_t>::type
37 InShapeVisitor::LayerInputShape(T* /* layer */) const
38 {
39  return 0;
40 }
41 
42 template<typename T>
43 inline typename std::enable_if<
44  HasInputShapeCheck<T>::value, std::size_t>::type
45 InShapeVisitor::LayerInputShape(T* layer) const
46 {
47  return layer->InputShape();
48 }
49 
50 } // namespace ann
51 } // namespace mlpack
52 
53 #endif
Linear algebra utility functions, generally performed on matrices or vectors.
Definition: cv.hpp:1
size_t operator()(LayerType *layer) const
Return the input shape of layer.