Add some LOGging when we detect nodes in a cycle

PiperOrigin-RevId: 205146924
This commit is contained in:
Sanjoy Das 2018-07-18 15:23:40 -07:00 committed by TensorFlower Gardener
parent e3006b1d70
commit c80f149322
2 changed files with 18 additions and 3 deletions

View File

@ -1042,6 +1042,14 @@ Status GraphConstructor::Convert() {
}
if (processed < node_defs_.size()) {
LOG(WARNING) << "IN " << __func__ << (node_defs_.size() - processed)
<< " NODES IN A CYCLE";
for (int64 i = 0; i < node_defs_.size(); i++) {
if (pending_count_[i] != 0) {
LOG(WARNING) << "PENDING: " << SummarizeNodeDef(*node_defs_[i])
<< "WITH PENDING COUNT = " << pending_count_[i];
}
}
return errors::InvalidArgument(node_defs_.size() - processed,
" nodes in a cycle");
}

View File

@ -247,9 +247,16 @@ Status SortByExecutionOrder(const GraphDef& input_graph_def,
}
}
if (processed < input_graph_def.node_size()) {
return errors::InvalidArgument(input_graph_def.node_size() - processed,
" nodes in a cycle");
if (processed < num_nodes) {
LOG(WARNING) << "IN " << __func__ << (num_nodes - processed)
<< " NODES IN A CYCLE";
for (int64 i = 0; i < num_nodes; i++) {
if (pending_count[i] != 0) {
LOG(WARNING) << "PENDING: " << SummarizeNodeDef(input_graph_def.node(i))
<< "WITH PENDING COUNT = " << pending_count[i];
}
}
return errors::InvalidArgument(num_nodes - processed, " nodes in a cycle");
}
return Status::OK();
}