aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/kernels/data/group_by_window_dataset_op.cc
diff options
context:
space:
mode:
authorGravatar Derek Murray <mrry@google.com>2018-08-21 11:48:37 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-21 11:59:01 -0700
commit9158b1b83a0128fc41bfccd80fe26d8231fe958b (patch)
tree4bb719d17c4284a5b07814ff24113fa5d0b446f0 /tensorflow/core/kernels/data/group_by_window_dataset_op.cc
parente28f9da84b51acdbf3234688daa4c55647041219 (diff)
[tf.data] Move captured function instantiation to iterator initialization time.
Previously, a function instantiation error (e.g. in `Dataset.map()`) would lead to an error in each GetNext() call that attempted to use the function. Moving this to iterator instantiation time has the benefit that the error will be reported once when the initialization op is executed, which has a more helpful stack trace, since it should not be conflated with other potential op failures. PiperOrigin-RevId: 209633511
Diffstat (limited to 'tensorflow/core/kernels/data/group_by_window_dataset_op.cc')
-rw-r--r--tensorflow/core/kernels/data/group_by_window_dataset_op.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/tensorflow/core/kernels/data/group_by_window_dataset_op.cc b/tensorflow/core/kernels/data/group_by_window_dataset_op.cc
index 288695f3cd..f993a68934 100644
--- a/tensorflow/core/kernels/data/group_by_window_dataset_op.cc
+++ b/tensorflow/core/kernels/data/group_by_window_dataset_op.cc
@@ -205,7 +205,13 @@ class GroupByWindowDatasetOp : public UnaryDatasetOpKernel {
: DatasetIterator<Dataset>(params) {}
Status Initialize(IteratorContext* ctx) override {
- return dataset()->input_->MakeIterator(ctx, prefix(), &input_impl_);
+ TF_RETURN_IF_ERROR(
+ dataset()->input_->MakeIterator(ctx, prefix(), &input_impl_));
+ TF_RETURN_IF_ERROR(dataset()->captured_key_func_->Instantiate(ctx));
+ TF_RETURN_IF_ERROR(dataset()->captured_reduce_func_->Instantiate(ctx));
+ TF_RETURN_IF_ERROR(
+ dataset()->captured_window_size_func_->Instantiate(ctx));
+ return Status::OK();
}
Status GetNextInternal(IteratorContext* ctx,