From e0944c4784d9d6bd43384bcd67bb7fe28f1d11ab Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Fri, 23 Jun 2017 15:23:34 -0700 Subject: Avoid doing unecessary work in the OptimizeGraph() function whenever possible PiperOrigin-RevId: 160003173 --- tensorflow/core/grappler/grappler_item_builder.cc | 4 ++++ tensorflow/core/grappler/grappler_item_builder.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tensorflow/core/grappler/grappler_item_builder.cc b/tensorflow/core/grappler/grappler_item_builder.cc index c6e3bc626e..0a0e000b52 100644 --- a/tensorflow/core/grappler/grappler_item_builder.cc +++ b/tensorflow/core/grappler/grappler_item_builder.cc @@ -70,6 +70,10 @@ void InitializeTensor(DataType type, Tensor* tensor) { // correct optimizations. Status OptimizeGraph(const GraphDef& graph_def, GraphDef* output_graph_def, const ItemConfig& cfg) { + if (!cfg.apply_optimizations && !cfg.inline_functions) { + return Status::OK(); + } + // Create a session option for a single GPU device. SessionOptions options; diff --git a/tensorflow/core/grappler/grappler_item_builder.h b/tensorflow/core/grappler/grappler_item_builder.h index 7135c83801..d385a1916e 100644 --- a/tensorflow/core/grappler/grappler_item_builder.h +++ b/tensorflow/core/grappler/grappler_item_builder.h @@ -32,7 +32,7 @@ struct ItemConfig { ignore_colocation(true), placeholder_unknown_output_shape_dim(-1), apply_optimizations(false), - inline_functions(true) {} + inline_functions(false) {} // If true, ignore all user specified node placement. bool ignore_user_placement; -- cgit v1.2.3