16 #ifndef MLPACK_METHODS_ANN_UTIL_CHECK_INPUT_SHAPE_HPP 17 #define MLPACK_METHODS_ANN_UTIL_CHECK_INPUT_SHAPE_HPP 26 const size_t inputShape,
27 const std::string& functionName)
29 for (
size_t l = 0; l < network.size(); ++l)
31 size_t layerInShape = boost::apply_visitor(
InShapeVisitor(), network[l]);
32 if (layerInShape == 0)
36 else if (layerInShape == inputShape)
42 std::string estr = functionName +
": the first layer of the network " +
43 "expects " + std::to_string(layerInShape) +
" elements, but the " +
44 "input has " + std::to_string(inputShape) +
" dimensions!";
45 throw std::logic_error(estr);
Linear algebra utility functions, generally performed on matrices or vectors.
void CheckInputShape(const T &network, const size_t inputShape, const std::string &functionName)
InShapeVisitor returns the input shape a Layer expects.