Second invocation of the model pruner after all other optimizers removes too many nodes in some cases in TF 2.0 mode.

PiperOrigin-RevId: 240180399
This commit is contained in:
A. Unique TensorFlower 2019-03-25 11:18:05 -07:00 committed by TensorFlower Gardener
parent e6ee14fb0e
commit 120cc36f0e

View File

@ -447,10 +447,6 @@ Status MetaOptimizer::OptimizeGraph(Cluster* cluster, const GrapplerItem& item,
optimization_results_.push_back(optimization_result); optimization_results_.push_back(optimization_result);
if (is_optimized) { if (is_optimized) {
// Run the model pruner again to clean things up.
if (!cfg_.disable_model_pruning() && model_pruner != nullptr) {
RUN_OPTIMIZER_OR_RETURN_IF_ERROR(model_pruner);
}
TF_RETURN_IF_ERROR(TopologicalSort(optimized_graph)); TF_RETURN_IF_ERROR(TopologicalSort(optimized_graph));
ReassignColocation(optimized_graph); ReassignColocation(optimized_graph);
// Make sure that the optimizers preserved the graph version. // Make sure that the optimizers preserved the graph version.