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