Handle DeadlineExceeded in OptimizeDatasetOp::MakeDataset correctly. Before this change, if we encounter a DeadlineExceeded error, the output dataset will not be set (i.e. be a nullptr), resulting in "Read uninitialized Dataset variant" when we try to use it.

PiperOrigin-RevId: 315005357
Change-Id: I91f1f3b4e99ddc733ec11b5040c6d01b094422ba
This commit is contained in:
Rachel Lim 2020-06-05 15:14:39 -07:00 committed by TensorFlower Gardener
parent c38ec78efc
commit 68ad29a995

View File

@ -60,6 +60,10 @@ void OptimizeDatasetOp::MakeDataset(OpKernelContext* ctx, DatasetBase* input,
if (errors::IsDeadlineExceeded(s)) {
// Ignore DeadlineExceeded as it implies that the attempted rewrite took too
// long which should not prevent further computation.
LOG(WARNING) << s.ToString();
*output = input;
input->Ref();
return;
}
OP_REQUIRES_OK(ctx, s);