237{
238 const auto operations = extractOperations(training_usedefs);
239 auto inputs_map = extractNodeInputs(training_usedefs);
240 auto outputs_map = extractNodeOutputs(training_usedefs);
241 uint32_t errors = 0;
242 for (const auto &index : operations)
243 {
244 const auto &node_inputs = inputs_map[
index];
245 for (const auto &operand_index : node_inputs)
246 {
247 try
248 {
249 const auto &uses = training_usedefs.at(operand_index).getTrainingUses();
250 bool operand_has_use = (uses.find(index) != uses.end());
251 if (!operand_has_use)
252 {
253 VERBOSE(EdgeChecker) <<
"[ERROR] EDGE MISMATCH : Missing USE edge - Operand "
254 << operand_index <<
" to Operation " <<
index << std::endl;
255 errors += 1;
256 }
257 }
258 catch (const std::out_of_range &e)
259 {
260 VERBOSE(EdgeChecker) <<
"[ERROR] OPEARAND NOT FOUND : Operation " <<
index
261 << " has Operand " << operand_index
262 << ", but the operand object is not present in the graph" << std::endl;
263 errors += 1;
264 }
265 }
266
267 const auto &node_outputs = outputs_map[
index];
268 for (const auto &operand_index : node_outputs)
269 {
270 try
271 {
272 const auto &defs = training_usedefs.at(operand_index).getTrainingDefs();
273 bool operand_has_def = (defs.find(index) != defs.end());
274 if (!operand_has_def)
275 {
276 VERBOSE(EdgeChecker) <<
"[ERROR] EDGE MISMATCH : Missing DEF edge - Operand"
277 << operand_index <<
" to Operation " <<
index << std::endl;
278 errors += 1;
279 }
280 }
281 catch (const std::out_of_range &e)
282 {
283 VERBOSE(EdgeChecker) <<
"[ERROR] OPEARAND NOT FOUND : Operation " <<
index
284 << " has Operand " << operand_index
285 << ", but the operand object is not present in the graph" << std::endl;
286 errors += 1;
287 }
288 }
289 }
290
291 VERBOSE(EdgeChecker) <<
"Total Number of errors : " << errors << std::endl;
292
293 return errors == 0;
294}