| 31 | } |
| 32 | |
| 33 | bool dnnc::graph::sanityCheck() { |
| 34 | bool result = true; |
| 35 | for (node *n : _nodes) { |
| 36 | std::vector<node *> next_level_nodes; |
| 37 | if (false == n->inputNodes(*this, next_level_nodes)) { |
| 38 | if (n->ntype() != node::INPUT && n->symbol() != opConstant) { |
| 39 | std::cerr << "ERROR (GRAPH): some of graph " + _name + "'s node " + |
| 40 | n->name() + "'s\n"; |
| 41 | std::cerr << " outputs are not connected to other nodes " |
| 42 | "in the graph.\n"; |
| 43 | result = false; |
| 44 | } |
| 45 | } |
| 46 | if (false == n->outputNodes(*this, next_level_nodes)) { |
| 47 | if (n->ntype() != node::OUTPUT) { |
| 48 | std::cerr << "ERROR (GRAPH): some of graph " + _name + "'s node " + |
| 49 | n->name() + "'s\n"; |
| 50 | std::cerr << " inputs are not connected to other nodes " |
| 51 | "in the graph.\n"; |
| 52 | result = false; |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | return result; |
| 57 | } |
| 58 | |
| 59 | #ifdef DNNC_GRAPH_TEST |
| 60 | using namespace dnnc; |
no test coverage detected