| 570 | } |
| 571 | |
| 572 | Status IsGraphValid(const GraphDef& graph_def) { |
| 573 | std::vector<std::pair<string, string>> invalid_inputs; |
| 574 | FindInvalidInputs(graph_def, &invalid_inputs); |
| 575 | if (!invalid_inputs.empty()) { |
| 576 | std::map<string, const NodeDef*> node_map; |
| 577 | MapNamesToNodes(graph_def, &node_map); |
| 578 | for (const std::pair<string, string>& invalid_input : invalid_inputs) { |
| 579 | LOG(ERROR) << "Invalid input " << invalid_input.second << " for node " |
| 580 | << invalid_input.first << " - " |
| 581 | << node_map[invalid_input.first]->DebugString(); |
| 582 | } |
| 583 | return errors::Internal( |
| 584 | "Invalid graph with inputs referring to nonexistent nodes"); |
| 585 | } |
| 586 | return Status::OK(); |
| 587 | } |
| 588 | |
| 589 | Status GetInOutTypes(const NodeDef& node_def, DataTypeVector* inputs, |
| 590 | DataTypeVector* outputs) { |