118{
119 py::object
scope = py::module::import(
"__main__").attr(
"__dict__");
120 _hooks->importAnalysis(analysis_path, scope, analysis_args);
121
122 try
123 {
125 importer.importGroup("value");
126
127 bool is_raw_data = importer.isRawData();
128
129 const auto num_records = importer.numData();
130 if (num_records == 0)
131 throw std::runtime_error("The input data file does not contain any record.");
132
135
136 for (int32_t record_idx = 0; record_idx < num_records; record_idx++)
137 {
138 if (num_inputs != static_cast<uint32_t>(importer.numInputs(record_idx)))
139 throw std::runtime_error("Wrong number of inputs.");
140
141 std::cout << "Running " << record_idx << "'th data" << std::endl;
142
143 for (uint32_t input_idx = 0; input_idx <
num_inputs; input_idx++)
144 {
145 const auto *
input_node = loco::must_cast<const luci::CircleInput *>(input_nodes[input_idx]);
148 std::vector<char>
input_data(getByteSize(input_node));
149
150 if (is_raw_data)
151 {
152
154 }
155 else
156 {
159 importer.readTensor(record_idx, input_idx, &dtype, &shape,
input_data.data(),
161
162
164 }
165
167 }
168
169 _hooks->startNetworkExecution(_module->graph());
170 _interpreter->interpret();
171 _hooks->endNetworkExecution(_module->graph());
172 }
173
174 std::cout << "Finished executing " << num_records << "'th data" << std::endl;
175 _hooks->endAnalysis();
176 }
177 catch (const H5::Exception &e)
178 {
179 H5::Exception::printErrorStack();
180 throw std::runtime_error("HDF5 error occurred.");
181 }
182}
void verifyTypeShape(const luci::CircleInput *input_node, const DataType &dtype, const Shape &shape)
std::vector< Node * > input_nodes(const Graph *)
DataType
"scalar" value type
CircleInput * input_node(loco::Graph *g, const loco::GraphInputIndex &index)
Find a Pull node with a given input index.
void checkInputDimension(const luci::CircleInput *input)