diff options
author | 2018-09-17 16:41:56 -0700 | |
---|---|---|
committer | 2018-09-17 16:50:56 -0700 | |
commit | 6805a8b27759a530f0ebab0670593a05455a64a0 (patch) | |
tree | 1ea29c728b29b5b5641ee00997debb7737bcb13c /tensorflow/core/kernels/data/scan_dataset_op.cc | |
parent | 0cdf60ff8239a68326af9610e715f42c773be731 (diff) |
Changing `OpInputList` so that it is a forward iterator and taking advantage of the fact in the tf.data kernels.
PiperOrigin-RevId: 213361953
Diffstat (limited to 'tensorflow/core/kernels/data/scan_dataset_op.cc')
-rw-r--r-- | tensorflow/core/kernels/data/scan_dataset_op.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/tensorflow/core/kernels/data/scan_dataset_op.cc b/tensorflow/core/kernels/data/scan_dataset_op.cc index 6e515d6cc8..dbe31f37b8 100644 --- a/tensorflow/core/kernels/data/scan_dataset_op.cc +++ b/tensorflow/core/kernels/data/scan_dataset_op.cc @@ -45,23 +45,12 @@ class ScanDatasetOp : public UnaryDatasetOpKernel { OpInputList initial_state_inputs; OP_REQUIRES_OK(ctx, ctx->input_list("initial_state", &initial_state_inputs)); - std::vector<Tensor> initial_state; - initial_state.reserve(initial_state_inputs.size()); - for (const Tensor& t : initial_state_inputs) { - initial_state.push_back(t); - } - - OpInputList inputs; - OP_REQUIRES_OK(ctx, ctx->input_list("other_arguments", &inputs)); - std::vector<Tensor> other_arguments; - other_arguments.reserve(inputs.size()); - for (const Tensor& t : inputs) { - other_arguments.push_back(t); - } + std::vector<Tensor> initial_state(initial_state_inputs.begin(), + initial_state_inputs.end()); std::unique_ptr<CapturedFunction> captured_func; - OP_REQUIRES_OK(ctx, CapturedFunction::Create( - func_, std::move(other_arguments), &captured_func)); + OP_REQUIRES_OK(ctx, CapturedFunction::Create(func_, ctx, "other_arguments", + &captured_func)); *output = new Dataset(ctx, input, func_, std::move(initial_state), std::move(captured_func), state_types_, output_types_, |