diff options
author | Derek Murray <mrry@google.com> | 2018-06-07 12:07:18 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-06-07 12:18:19 -0700 |
commit | 0dab0f538b78b0a0f1ec4f7dc5fb3005b5efdc94 (patch) | |
tree | 573d1e326752396da43a75530e156e3da4359999 /tensorflow/core/kernels/functional_ops.cc | |
parent | 501cf726cbee2ee13efef43884a6552ca211979d (diff) |
Avoid unnecessary `DoneCallback` copies in functional_ops.cc.
PiperOrigin-RevId: 199674121
Diffstat (limited to 'tensorflow/core/kernels/functional_ops.cc')
-rw-r--r-- | tensorflow/core/kernels/functional_ops.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tensorflow/core/kernels/functional_ops.cc b/tensorflow/core/kernels/functional_ops.cc index e0d594fa25..e0be57f972 100644 --- a/tensorflow/core/kernels/functional_ops.cc +++ b/tensorflow/core/kernels/functional_ops.cc @@ -152,7 +152,7 @@ class IfOp : public AsyncOpKernel { : kernel_(kernel), ctx_(ctx), cond_(cond), - done_(done), + done_(std::move(done)), lib_(CHECK_NOTNULL(ctx_->function_library())) { SetRunOptions(ctx_, &opts_, true /* always_collect_stats */); for (int i = 1; i < ctx_->num_inputs(); ++i) { @@ -174,9 +174,9 @@ class IfOp : public AsyncOpKernel { s = SetOutputs(kernel_, ctx_, rets_); } ctx_->SetStatus(s); - auto done = done_; + DoneCallback captured_done(std::move(done_)); delete this; - done(); + captured_done(); }); } @@ -257,7 +257,7 @@ class WhileOp : public AsyncOpKernel { ctx_(ctx), cond_handle_(cond_handle), body_handle_(body_handle), - done_(done), + done_(std::move(done)), lib_(CHECK_NOTNULL(ctx_->function_library())) { SetRunOptions(ctx_, &opts_, false /* always_collect_stats */); for (int i = 0; i < ctx_->num_inputs(); ++i) { |