aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <bsteiner@google.com>2017-06-23 15:23:34 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-23 15:28:08 -0700
commite0944c4784d9d6bd43384bcd67bb7fe28f1d11ab (patch)
tree61161c5024a9f546bc3136d541b0e7834cb0d16d
parent5e25a9c215d418fb5431a2cd5ac726d0f155f77f (diff)
Avoid doing unecessary work in the OptimizeGraph() function whenever possible
PiperOrigin-RevId: 160003173
-rw-r--r--tensorflow/core/grappler/grappler_item_builder.cc4
-rw-r--r--tensorflow/core/grappler/grappler_item_builder.h2
2 files changed, 5 insertions, 1 deletions
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;