diff options
author | 2017-09-27 13:48:03 -0700 | |
---|---|---|
committer | 2017-09-27 13:53:53 -0700 | |
commit | 2a5fb08bf2885cba29065d7269c5f6a32614b89a (patch) | |
tree | f8bf4a817bdce4daecdbb22a897f7587985c18f7 /tensorflow/core/kernels/function_ops.cc | |
parent | 301b14c240fe99249dc2225132a7ebe5cbecbdc4 (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.cc | 1 |
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) { |