12 #include "lwtnn/Exceptions.hh"
19 std::vector<size_t> get_value_indices(
20 const std::vector<std::string>&
order,
21 const std::vector<lwt::Input>&
inputs)
23 std::map<std::string, size_t> order_indices;
24 for (
size_t i = 0;
i <
order.size();
i++) {
27 std::vector<size_t> value_indices;
29 if (!order_indices.count(
input.name)) {
30 throw lwt::NNConfigurationException(
"Missing input " +
input.name);
32 value_indices.push_back(order_indices.at(
input.name));
45 const std::vector<Input>&
inputs,
46 const std::vector<std::string>&
order):
60 size_t input_number = 0;
62 if (
static_cast<int>(
index) >= in.rows()) {
63 throw NNEvaluationException(
67 invec(input_number) = in(
index);
76 const std::vector<Input>&
inputs,
77 const std::vector<std::string>&
order):
90 throw NNConfigurationException(
"need at least one input");
95 using namespace Eigen;
96 size_t n_cols = in.cols();
100 if (
static_cast<int>(
index) >= in.rows()) {
101 throw NNEvaluationException(
105 inmat.row(in_num) = in.row(
index);