aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/common_runtime/lower_if_op.cc
diff options
context:
space:
mode:
authorGravatar A. Unique TensorFlower <gardener@tensorflow.org>2018-06-18 13:36:36 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-18 13:39:30 -0700
commitab251a0ec66a3c8b88ca467e49bfc68d18a2a8e9 (patch)
treea7c5b15fb417b2f66d52a51a55de622dcc221c73 /tensorflow/core/common_runtime/lower_if_op.cc
parent3d3196f34173e5c6e1f9297e2fcd4c316fe903fd (diff)
Enables `If` operator lowering in cond_v2 when XLA is disabled. Lowering allows cond_v2 to avoid some of the limitations of Functions, allowing users to specify devices & colocation inside of cond_v2 branches, and enabling non-strict evaluation & partial pruning of branches. This brings cond_v2 closer to feature parity with tf.cond.
However, we do not lower `If` in the XLA context because it is easier for XLA to apply its own optimizations when dealing with un-lowered `If` operators than with lowered switch/merge control flow. Also adds a toggleable flag in for InlineFunctionBody in function.cc that prevents the function caller device from overriding the devices of function body nodes. This is necessary for cond_v2 branches to support explicitly-specified devices. Adds several tests to make sure that: - lowering is usually enabled - lowering is disabled for XLA - node colocation inside of cond_v2 branches works - explicit device placement inside of cond_v2 branches works PiperOrigin-RevId: 201049850
Diffstat (limited to 'tensorflow/core/common_runtime/lower_if_op.cc')
-rw-r--r--tensorflow/core/common_runtime/lower_if_op.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/core/common_runtime/lower_if_op.cc b/tensorflow/core/common_runtime/lower_if_op.cc
index 567c81870c..dfce7c23e7 100644
--- a/tensorflow/core/common_runtime/lower_if_op.cc
+++ b/tensorflow/core/common_runtime/lower_if_op.cc
@@ -206,7 +206,7 @@ Status InlineCallInGraph(Node* n, Graph* g) {
&fbody));
// TODO(jpienaar): Improve this interface to make the need to delete it
// explicit.
- InlineFunctionBody(g->flib_def(), g, n, fbody);
+ InlineFunctionBody(g->flib_def(), g, n, fbody, false);
delete fbody;
return Status::OK();
}