aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/function_ops.cc
diff options
context:
space:
mode:
authorGravatar Eugene Brevdo <ebrevdo@google.com>2017-09-27 13:48:03 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-09-27 13:53:53 -0700
commit2a5fb08bf2885cba29065d7269c5f6a32614b89a (patch)
treef8bf4a817bdce4daecdbb22a897f7587985c18f7 /tensorflow/core/kernels/function_ops.cc
parent301b14c240fe99249dc2225132a7ebe5cbecbdc4 (diff)
SymbolicGradients: create the underlying runtime with the correct step container.
This fixes a bug where calling tf.gradients of a tf.while_loop inside a Defun would hard crash the program. Also added some safety checks inside StackOps to avoid the hard crash if something like this happens again. PiperOrigin-RevId: 170246274
Diffstat (limited to 'tensorflow/core/kernels/function_ops.cc')
-rw-r--r--tensorflow/core/kernels/function_ops.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/tensorflow/core/kernels/function_ops.cc b/tensorflow/core/kernels/function_ops.cc
index a7206f6258..584d41dfe0 100644
--- a/tensorflow/core/kernels/function_ops.cc
+++ b/tensorflow/core/kernels/function_ops.cc
@@ -241,6 +241,7 @@ class SymbolicGradientOp : public AsyncOpKernel {
opts.cancellation_manager = ctx->cancellation_manager();
opts.runner = ctx->runner();
opts.stats_collector = ctx->stats_collector();
+ opts.step_container = ctx->step_container();
std::vector<Tensor> args;
args.reserve(ctx->num_inputs());
for (int i = 0; i < ctx->num_inputs(); ++i) {