message: Print both number of nodes and edges after each Grappler optimizer.
diff: @@ -30,6 +30,23 @@ limitations under the License.
  namespace tensorflow {
  namespace grappler {
  +namespace {
  +int64 NumEdges(const GraphDef& graph) {
  + int64 num_edges = 0;
  + for (const auto& node : graph.node()) {
  + num_edges += node.input_size();
  + }
  + return num_edges;
  +}
  +
  +string PrintSizesBeforeAfter(const GraphDef& before, const GraphDef& after) {
  + return strings::StrCat("Graph size before: ", before.node_size(), " nodes, ",
  + NumEdges(before),
  + " edges. Graph size after: ", after.node_size(),
  + " nodes, ", NumEdges(after), " edges.");
  +}
  +} // namespace
  +
  std::unique_ptr<GraphOptimizer> MetaOptimizer::NewOptimizer(
  const string& optimizer) {
  VLOG(1) << "Adding graph optimization pass: " << optimizer;
  @@ -128,10 +145,7 @@ Status MetaOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item,
  } else {
  already_optimized = true;
  result = strings::StrCat(
  - "OK. "
  - "Graph size before: ",
  - item.graph.node_size(),
  - ". Graph size after: ", optimized_graph->node_size());
  + "OK. ", PrintSizesBeforeAfter(item.graph, *optimized_graph));
  }
  result_.push_back(std::make_pair(optimizer->name(), result));
  VLOG(1) << "Optimizer " << optimizer->name()
  @@ -148,10 +162,8 @@ Status MetaOptimizer::Optimize(Cluster* cluster, const GrapplerItem& item,
  result = status.ToString();
  } else {
  result = strings::StrCat(
  - "OK. "
  - "Graph size before: ",
  - optimized_item.graph.node_size(),
  - ". Graph size after: ", optimized_graph->node_size());
  + "OK. ",
  + PrintSizesBeforeAfter(optimized_item.graph, *optimized_graph));
  }
  result_.push_back(std::make_pair(optimizer->name(), result));
  VLOG(1) << "Optimizer " << optimizer->name()
  